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

No way to convert or make use of <no data> queries #3264

Closed
swarminglogic opened this Issue Oct 9, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@swarminglogic
Copy link

swarminglogic commented Oct 9, 2017

I've encountered a situation where I need to make queries for counters, where some labels are determined ahead of time, and some, not.

The query: "Please tell me how many times A=x, B=y has occurred in the last N time" returns unless that metric is registered for those labels. For gauges, histograms, summaries, etc, this makes sense. If you don't have that particular measurement, there isn't much meaning to any value.

However, "how many times has x,y,z occurred" is an obvious "0" even when you haven't registered a single occurrence of it. Having to register these ahead of time is not only silly, but unfeasible in some use cases.

Returning in the case of counters is also fine, and reasonable. No having a way to use the absence of such a metric, is highly limiting, and I'm using all the imagination to find a case where it could be problematic.

What did you do?
Tried to ask "How many times has x-y-z occurred?", and have a way to make no observations be evaluated as 0, or something I can use in arithmetic operations.

What did you expect to see?
A method or conditional operation that lets me convert the absence of data, as something of my choice.

What did you see instead? Under which circumstances?
A limitation of the PromQL that boggles my mind.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Oct 9, 2017

See https://www.robustperception.io/existential-issues-with-metrics/

This is expected behaviour, if there's no data the answer is nothing.

@swarminglogic

This comment has been minimized.

Copy link
Author

swarminglogic commented Oct 9, 2017

The expected behaviour is quite fine, and I don't mean to suggest it should be changed. The inability to convert "nothing" to "0", for when that is meaningful, is what's missing.

When counting occurrences of something, the conceptual nothing is the same as the countable 0. Being able to express that in PromQL should be possible without a fallback hack as mentioned in that article.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Oct 9, 2017

The blog post details how to handle this.

It makes more sense to ask questions like this on the prometheus-users mailing list rather than in a GitHub issue. On the mailing list, more people are available to potentially respond to your question, and the whole community can benefit from the answers provided.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 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 23, 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.