Reputation: 47
I am trying to find a way to write a query in grafana which will display only the highest of three values (coming from kube.state.metrics / prometheus) in a singlestat panel.
I have tried using max(), but this only returns the highest value of a timeline of a single metric.
I am looking to get the following output: Variables: a = 10, b = 15 , c = 4 Query: maxValue(a, b, c) Result: 15
Is this possible in Grafana / PromQL?
Thanks for your help
Upvotes: 0
Views: 3102
Reputation: 47
I have found a solution. I am using a plugin, called "Blendstat" for Grafana, which is basically a singlestat panel with added support for more than one query.
In the visualisation tab is a "blend mode" parameter, which lets me choose "Max". The result is the highest value of the three queries.
Upvotes: 0
Reputation: 10104
If you're talking vectors (as in "a sample with labels"), then this should work:
(metric1 > metric2 or metric2) > metric3 or metric3
If you're talking scalars, then you'd need to add a vector()
around each value.
Upvotes: 0