[Serve] Exclude early partial period in timeseries aggregation#61403
Draft
abrarsheikh wants to merge 3 commits intomasterfrom
Draft
[Serve] Exclude early partial period in timeseries aggregation#61403abrarsheikh wants to merge 3 commits intomasterfrom
abrarsheikh wants to merge 3 commits intomasterfrom
Conversation
Signed-off-by: abrar <abrar@anyscale.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable improvement to the timeseries aggregation logic by excluding the initial partial period where data from some series is missing, which prevents undercounting and biased aggregations. The implementation is clear and includes a good test case. I've found one potential issue with a boundary condition that could cause the fix to not apply in some cases. Please see my detailed comment.
Signed-off-by: abrar <abrar@anyscale.com>
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.
Problem: When merging timeseries from multiple replicas/handles, series that start later are implicitly 0 before their first data point. That undercounts the total and biases aggregations (especially mean) downward.
Solution: Start the aggregation window at the timestamp when all series have at least one point (
aligned_start = max(first_timestamp)across series). This removes the early partial period where some series are implicitly 0.Problem: When merging timeseries from replicas and handles with LOCF, the same request can appear in both because they report at different times (e.g. replica: 4 running, handle: 2 queued). That double-counts requests and inflates the total, biasing aggregations (especially mean) upward and causing over-scaling.
Solution: Cap the aggregated value by the current snapshot total (sum of the latest value from each series). By the time the autoscaler runs, the handle has usually updated (e.g. 0 queued), so the cap is 4 + 0 = 4, and the inflated value (e.g. 4.31) is reduced to the true total.