I want to calculate the sum_over_time
of the product of two instant vectors:
How can I get this to work?
I tried to use:
sum_over_time((metric_a{label1:"A"} \* metric_b{label1:"A"})\[30d\])
but I received the error message "ranges only allowed for vector selectors"
You need to use Subquery:
sum_over_time((metric_a{label1='A'} * metric_b{label1='A'})[30d:])
(pls note that a default resolution/step is used in the example, you might want a custom one for your query)
In Prometheus, you can do this to get a range vector:
metric[1m]
However, you cannot do this with expression:
(metric)[1m]
---> parse error: ranges only allowed for vector selectors
Instead, a subquery should be used:
(metric)[1m:]