Prometheus: Feature request: Filter queries on metric value

Created on 13 Nov 2015  路  3Comments  路  Source: prometheus/prometheus

Starting using Prometheus I'm looking for a way to filter some of my queries on the metric value.
Filter already allow us to select a set of metrics according to labels, but in some case, it would be useful to filter on the metric value.

The easiest example that I have in mind would be to filter "up" query to only retrieve down instances.

http://localhost:9090/api/v1/query?query=up{job="node"}&time=2015-11-13T11:30:00.0Z

Maybe this could be done with a specific function to look like the following ?

http://localhost:9090/api/v1/query?query=filter(,,up{job="node"})&time=2015-11-13T11:30:00.0Z

So that the request would look like this :
http://localhost:9090/api/v1/query?query=filter(gt,0,up{job="node"})&time=2015-11-13T11:30:00.0Z

Thanks for your feedback.

Most helpful comment

Sounds like you simply want up{job="node"} == 1.
Comparison operations do filter by default.

All 3 comments

Sounds like you simply want up{job="node"} == 1.
Comparison operations do filter by default.

Oh, great :-)

I did not understood this from "http://prometheus.io/docs/querying/operators/".

Thank you very much for your quick reply.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings