proposal: trim query_range response to user-requested time window#7288
Open
venkatchinmay wants to merge 1 commit intocortexproject:masterfrom
Open
proposal: trim query_range response to user-requested time window#7288venkatchinmay wants to merge 1 commit intocortexproject:masterfrom
venkatchinmay wants to merge 1 commit intocortexproject:masterfrom
Conversation
Add docs/proposals/query-range-response-trimming.md proposing a new opt-in RangeTrimMiddleware (querier.trim-response-to-requested-range) that clips the final query_range response back to the exact [start, end] window requested by the user. This fixes data leakage outside the requested range caused by StepAlignMiddleware flooring start to the nearest step boundary, and SplitByIntervalMiddleware boundary rounding. Author: Chinmay Venkat Signed-off-by: Your Name <you@example.com>
Member
|
@venkatchinmay |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7289
What
Adds docs/proposals/query-range-response-trimming.md — a proposal for a new opt-in middleware that clips the
query_rangeresponse to the exact[start, end]window requested by the user.Problem
When
querier.align-querier-with-step: trueis enabled,StepAlignMiddlewarefloors the user'sstarttime to the nearest step boundary before the rest of the middleware chain runs:The original
start=09:01is permanently lost — no downstream middleware can recover it to trim the response. The user receives data from09:00even though they asked for09:01.The same drift can occur from SplitByIntervalMiddleware's nextIntervalBoundary rounding.
Proposed Fix
A new
RangeTrimMiddlewareas the outermost middleware, enabled via:It captures the original
start/endbefore any mutation, lets the full stack run internally (alignment, splitting, caching, sharding), then trims the final response using the existingExtractor.Extract()interface — which already handles per-sample and per-step-stats trimming correctly.Key Points
false, no behaviour change for existing deploymentsRelated
pkg/querier/tripperware/queryrange/results_cache.go