Skip to content
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

Feature request: Filter queries on metric value #1216

Closed
alexissavin opened this Issue Nov 13, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@alexissavin
Copy link

alexissavin commented Nov 13, 2015

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.

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Nov 13, 2015

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

@alexissavin

This comment has been minimized.

Copy link
Author

alexissavin commented Nov 13, 2015

Oh, great :-)

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

Thank you very much for your quick reply.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

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.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.