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
PromQL, binary operators for range vectors #14069
Comments
This example nicely illustrates why binary operators for range vectors are not as easy as it looks.
While @darshanime is right that binary operators for range vectors is covered by #7263, this particular use case is already supported. |
Okay interesting. I did try |
Resolution is optional, you can write What's not optional is the colon. Without the colon, you are not writing a subquery, but a range selector. |
Proposal
AFAIK, binary operators only work on instant vectors. This is a feature request to add binary operators for range vectors as well.
Use case: I want to take the difference of two gauge metrics, and then take the moving average over 15m. Syntax could look like this in PromQL:
avg_over_time(foo[15m] - bar[15m])
. There is no way to compute this by eagerly converting to instant vectors first; e.g.avg_over_time(foo[15m]) - avg_over_time(bar[15m])
is not equivalent; see Simpson's paradox.I'm imagining the range vectors the operator applies to must have the same number of points, or else it is disallowed or NaN's are given where one of the vectors has more points. Whatever is sensible given the current aggregation engine. E.g. Functionally, I would assume it behaves the same as though you were performing the operator on two instant vector time series, except this time it is repeated across many lookback ranges of a range vector.
The text was updated successfully, but these errors were encountered: