Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[query] Custom handler support #2073

Merged
merged 2 commits into from
Jan 5, 2020
Merged

[query] Custom handler support #2073

merged 2 commits into from
Jan 5, 2020

Conversation

arnikola
Copy link
Collaborator

What this PR does / why we need it:
Allows custom 3rd party handlers.

Does this PR introduce a user-facing and/or backwards incompatible change?:

NONE

Does this PR require updating code package or user-facing documentation?:

NONE

@codecov
Copy link

codecov bot commented Dec 14, 2019

Codecov Report

Merging #2073 into master will decrease coverage by 0.1%.
The diff coverage is 51.1%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #2073     +/-   ##
========================================
- Coverage    72.5%   72.4%   -0.2%     
========================================
  Files        1005    1007      +2     
  Lines       86287   86395    +108     
========================================
- Hits        62584   62552     -32     
- Misses      19530   19669    +139     
- Partials     4173    4174      +1
Flag Coverage Δ
#aggregator 82% <ø> (ø) ⬆️
#cluster 85.6% <ø> (ø) ⬆️
#collector 64.8% <ø> (ø) ⬆️
#dbnode 79.7% <100%> (-0.1%) ⬇️
#m3em 73.2% <ø> (ø) ⬆️
#m3ninx 73.9% <ø> (-0.1%) ⬇️
#m3nsch 51.1% <ø> (ø) ⬆️
#metrics 17.6% <ø> (ø) ⬆️
#msg 74.7% <ø> (ø) ⬆️
#query 68.4% <50.5%> (-0.6%) ⬇️
#x 83.4% <ø> (+0.2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b3917b5...f38c61b. Read the comment docs.

@@ -42,6 +42,11 @@ const (
// of propagating aggregator placement to clients, usually needed when there is
// a large amount of clients sending traffic to m3aggregator.
defaultM3AggWarmupDuration = 0

// DefaultServiceEnvironment is the default service ID environment.
DefaultServiceEnvironment = "default_env"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these already declared somewhere else or were they moved?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it was moved from headers.go; moved it back 👍

}

handler := httpd.NewHandler(handlerOptions, runOpts.CustomHandlers...)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

"github.com/m3db/m3/src/query/storage"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Unnecessary end line between imports?

// MetricsTypeHeader sets the write or read metrics type to restrict
// metrics to.
// Valid values are "unaggregated" or "aggregated".
MetricsTypeHeader = "M3-Metrics-Type"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these need to be moved back to headers.go or staying here?

Copy link
Collaborator

@robskillington robskillington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than final minor comments

@arnikola arnikola force-pushed the arnikola/custom-handler branch from 0310f08 to 842a9e1 Compare January 5, 2020 03:00
@arnikola arnikola changed the base branch from arnikola/cleanup-query to master January 5, 2020 03:01
Name: nameBytes,
Value: matchValues,
Type: models.MatchField,
Name: nameBytes,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps remove var matchValues = []byte(".*") ? Looks like it's not used anymore.

CustomHandlers []options.CustomHandler

// CustomParseFunction is a custom parsing function.
CustomParseFunction promql.ParseFn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Should we call this CustomPromQLParseFunction? In case we need to add another language, etc which may cause a backwards incompat change for those using this code?

Copy link
Collaborator

@robskillington robskillington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor comments

@arnikola arnikola merged commit 597c894 into master Jan 5, 2020
@arnikola arnikola deleted the arnikola/custom-handler branch January 5, 2020 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants