-
Notifications
You must be signed in to change notification settings - Fork 39
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
Support with for window #13
Conversation
Signed-off-by: Megrez Lu <[email protected]>
Signed-off-by: Megrez Lu <[email protected]>
Signed-off-by: Megrez Lu <[email protected]>
@valyala @hagen1778 Request for view |
…ions Support using WITH template vars in the following places where duration can be passed: - Lookbehind windows in square brackets: `with (w=5m) m[w]` is transformed to `m[5m]` - Steps in square brackets: `with (step=5m) m[1h:step]` is transformed to `m[1h:5m]` - Offsets: `with (off=5m) m offset off` is transformed to `m offset 5m` Updates VictoriaMetrics/VictoriaMetrics#4025 Updates #12 Thanks to @lujiajing1126 for the initial implementation at #13 Note that this feature doesn't allow specifying dynamic durations in the following way: with (w = ((day_of_month()-1) * 24 + hour()) + "h") m[w] It allows using only static durations Support for dynamic durations requires significant refactoring of the code responsible for calculating rollups in `/api/v1/query_range` handler. It will be needed to use different lookbehind windows per each calculated data point per each `step`. Currently the code assumes that the lookbehind window is static across every calculated data point.
…0.61.1 This adds support for passing durations via WITH template vars: - `WITH (w = 5m) m[w]` is transformed to `m[5m]` - `WITH (f(w, step, off) = m[w:step] offset off) f(5m, 10s, 1h)` is transformed to `m[5m:10s] offset 1h` Updates #4025 Updates VictoriaMetrics/metricsql#12 See also the initial implementation by @lujiajing1126 at VictoriaMetrics/metricsql#13
…0.61.1 This adds support for passing durations via WITH template vars: - `WITH (w = 5m) m[w]` is transformed to `m[5m]` - `WITH (f(w, step, off) = m[w:step] offset off) f(5m, 10s, 1h)` is transformed to `m[5m:10s] offset 1h` Updates #4025 Updates VictoriaMetrics/metricsql#12 See also the initial implementation by @lujiajing1126 at VictoriaMetrics/metricsql#13
@lujiajing1126 , thanks for the pull request! I used it as a basis for the commit f3dd382 .
Unfortunately the commit doesn't allow passing dynamically calculated duration values depending on the evaluation timestamp, because this requires significant refactoring in the code responsible for calculating rollup function results per each returned data point from /api/v1/query_range. The temporary workaround is to calculate the needed duration values at client side and pass them to /api/v1/query depending on the As for the original issue VictoriaMetrics/VictoriaMetrics#4025 , we need to think more how to properly implement it properly. The Closing the pull request then, since it has been overridden by the commit f3dd382 . |
FYI, the functionality described in this comment has been included in VictoriaMetrics v1.92.0. |
Resolve #12