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][coordinator] Add time range limit with M3-Limit-Max-Range to restrict time range of a query #3538

Merged
merged 14 commits into from
Jun 8, 2021

Conversation

robskillington
Copy link
Collaborator

What this PR does / why we need it:

Useful when combined with require exhaustive false to enforce certain use cases where a time range limit must be enforced but the time windows can be arbitrarily still modified by the caller.

Special notes for your reviewer:

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

@robskillington robskillington changed the title [query][coordinator] Add time range limit with M3-Limit-Max-Range to restrict time range of a query WIP [query][coordinator] Add time range limit with M3-Limit-Max-Range to restrict time range of a query Jun 3, 2021
@codecov
Copy link

codecov bot commented Jun 3, 2021

Codecov Report

Merging #3538 (304e7ee) into master (9fbb3ed) will decrease coverage by 0.0%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #3538     +/-   ##
========================================
- Coverage    55.9%   55.9%   -0.1%     
========================================
  Files         549     549             
  Lines       61439   61439             
========================================
- Hits        34365   34351     -14     
- Misses      23971   23979      +8     
- Partials     3103    3109      +6     
Flag Coverage Δ
aggregator 57.1% <ø> (ø)
cluster ∅ <ø> (∅)
collector 54.3% <ø> (ø)
dbnode 60.3% <ø> (-0.1%) ⬇️
m3em 46.4% <ø> (ø)
metrics 19.8% <ø> (ø)
msg 74.5% <ø> (ø)

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 9fbb3ed...304e7ee. Read the comment docs.

@robskillington robskillington changed the title WIP [query][coordinator] Add time range limit with M3-Limit-Max-Range to restrict time range of a query [query][coordinator] Add time range limit with M3-Limit-Max-Range to restrict time range of a query Jun 8, 2021
@@ -91,6 +91,10 @@ const (
// the number of docs returned by each storage node.
LimitMaxDocsHeader = M3HeaderPrefix + "Limit-Max-Docs"

// LimitMaxRangeHeader is the M3 limit range header that limits
// the time range returned by each storage node.
LimitMaxRangeHeader = M3HeaderPrefix + "Limit-Max-Range"
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: if this is aggregate query specific, should scope the header name to indicate this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's applicable to both 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(Updated integration tests to match)

@@ -279,7 +279,7 @@ func divideSeriesLists(ctx *common.Context, dividendSeriesList, divisorSeriesLis

// aggregate takes a list of series and returns a new series containing the
// value aggregated across the series at each datapoint using the specified function.
// This function can be used with aggregation functionsL average (or avg), avg_zero,
// This function can be used with aggregation functions average (or avg), avg_zero,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice, how did you even find this heh

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I had touched this file by accident and linter had gone off, then I reverted but the fix stayed. Good old linter hah.

@robskillington robskillington enabled auto-merge (squash) June 8, 2021 17:57
@robskillington robskillington enabled auto-merge (squash) June 8, 2021 18:24
fetchOptions.RequireExhaustive,
fetchRangeLimit.String(),
fetchRange.String())
err := xerrors.NewInvalidParamsError(consolidators.NewLimitError(msg))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice, should this emit a metric too to match the other limit exceeded errors?

@robskillington robskillington merged commit 6f70579 into master Jun 8, 2021
Copy link
Collaborator

@arnikola arnikola left a comment

Choose a reason for hiding this comment

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

LGTM w nit

@robskillington robskillington deleted the r/query-time-range-limit branch June 8, 2021 19:06
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