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] Take bounds into account for list endpoints #3110

Merged
merged 2 commits into from
Jan 21, 2021

Conversation

arnikola
Copy link
Collaborator

Adds bounds parsing to /api/v1/labels and /api/v1/label/<label_name>/values endpoints

Copy link
Collaborator

@wesleyk wesleyk left a comment

Choose a reason for hiding this comment

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

some q's / suggestions but LG!

}

if start.After(end) {
err := fmt.Errorf("start %v must be after end %v", start, end)
Copy link
Collaborator

Choose a reason for hiding this comment

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

before end

// ParseStartAndEnd parses start and end params from the request.
func ParseStartAndEnd(
r *http.Request,
parseOpts xpromql.ParseOptions,
Copy link
Collaborator

Choose a reason for hiding this comment

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

why does this need the whole parseOpts instead of only the NowFn()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Figured this was cleaner than building a new parseOpts on each query; can go that route if preferred

parseOpts xpromql.ParseOptions,
) (time.Time, time.Time, error) {
if err := r.ParseForm(); err != nil {
return time.Time{}, time.Time{}, xerrors.NewInvalidParamsError(err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

will this propagate as a 400?

@@ -123,7 +123,7 @@ func TestTagValues(t *testing.T) {
url := fmt.Sprintf("/label/{%s}/values", NameReplace)

for _, tt := range names {
path := fmt.Sprintf("/label/%s/values", tt.name)
path := fmt.Sprintf("/label/%s/values?start=100", tt.name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we have a case with an end too?

@codecov
Copy link

codecov bot commented Jan 21, 2021

Codecov Report

Merging #3110 (f6a59b6) into master (7ae7b3c) will decrease coverage by 0.0%.
The diff coverage is 58.5%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #3110     +/-   ##
=========================================
- Coverage    72.2%    72.2%   -0.1%     
=========================================
  Files        1084     1084             
  Lines      100264   100188     -76     
=========================================
- Hits        72484    72416     -68     
+ Misses      22751    22734     -17     
- Partials     5029     5038      +9     
Flag Coverage Δ
aggregator 75.8% <ø> (-0.1%) ⬇️
cluster 84.8% <ø> (ø)
collector 84.3% <ø> (ø)
dbnode 78.7% <ø> (+<0.1%) ⬆️
m3em 74.4% <ø> (ø)
m3ninx 73.2% <ø> (+<0.1%) ⬆️
metrics 20.0% <ø> (ø)
msg 74.2% <ø> (-0.1%) ⬇️
query 67.2% <58.5%> (-0.1%) ⬇️
x 80.4% <ø> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.


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 7ae7b3c...f6a59b6. Read the comment docs.

@arnikola arnikola merged commit 9be8ef9 into master Jan 21, 2021
@arnikola arnikola deleted the arnikola/respect-bounds-list branch January 21, 2021 22:34
soundvibe added a commit that referenced this pull request Jan 22, 2021
* master:
  [DOCS] Update to cluster docs (#3084)
  [dbnode][coordinator] Ensure docs limit is propagated for search and aggregate RPCs (#3108)
  [query] Take bounds into account for list endpoints (#3110)
  Add warning to changing blocksize (#3096)
  Add support for dynamic query limit overriding (#3090)
  [tests] test setups exported to allow us to use it from other packages (#3042)
  [query] Implemented Graphite's pow function (#3048)
  [dbnode] Direct conversion of encoded tags to doc.Metadata (#3087)
  [tests] Skip flaky TestWatchNoLeader (#3106)
  [dbnode] Faster search of tag bytes in convert.FromSeriesIDAndTags (#3075)
  Replace bytes.Compare() == 0 with bytes.Equal() (#3101)
  Capture seekerMgr instead Rlock (#3104)
  [m3db] Check bloom filter before stream request allocation (#3103)
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