Add anchored and smoothed to vector selectors. #16457
Draft
+1,132
−584
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.
This "PoC" is not finished nor optimized. It currently also returns data when there is only one point in the selector. It is not ready for use and just there to play around
This adds "anchored" and "smoothed" keywords that can be used following a matrix selector.
"Anchored" selects the last point before the range (or the first one after the range) and adds it at the boundary of the matrix selector.
"Smoothed" applies linear interpolation at the edges using the points around the edges. In the absence of a point before or after the edge, the first or the last point is added to the edge, without interpolation.
A complete design doc will follow.
Exemple usage
increase(caddy_http_requests_total[5m] anchored)
(equivalent ofcaddy_http_requests_total - caddy_http_requests_total offset 5m
but takes counter reset into consideration)rate(caddy_http_requests_total[5m] smoothed)
Other limitations
Does not work with Subqueries and Native Histograms.