-
Notifications
You must be signed in to change notification settings - Fork 455
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] Add series metadata label limit header for trimming response #3348
[query] Add series metadata label limit header for trimming response #3348
Conversation
TotalSeries: returnedDataLimited.TotalSeries, | ||
Datapoints: returnedDataLimited.Datapoints, | ||
} | ||
err = handleroptions.AddResponseHeaders(w, resultMetadata, fetchOptions, limited, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we're always adding the response header now, 👍
cc @rallen090
ReturnedSeriesMetadataLimit: opts.ReturnedSeriesMetadataLimit, | ||
} | ||
) | ||
renderResult, err := prometheus.RenderSeriesMatchResultsJSON(noopWriter, results, renderOpts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave comments on these noop render calls to explain the purpose is to apply the limiting first so we can write the header before the actual body writing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sg.
total += len(tag.Values) | ||
if opts.ReturnedSeriesMetadataLimit > 0 && rendered >= opts.ReturnedSeriesMetadataLimit { | ||
limited = true | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I see - so we continue
here so we can still count total
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What this PR does / why we need it:
Adds ability to trim series metadata / label metadata via header.
Special notes for your reviewer:
Does this PR introduce a user-facing and/or backwards incompatible change?:
Does this PR require updating code package or user-facing documentation?: