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

Return error on duplicate label matchers in PromQL query #2517

Closed
stuartnelson3 opened this Issue Mar 23, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@stuartnelson3
Copy link
Member

stuartnelson3 commented Mar 23, 2017

What did you do?

I executed the following query:

http_request_duration_milliseconds{quantile="0.99", quantile="0.5"}

(Actual metric name was different)

What did you expect to see?

An error saying that I can't specify the same label matcher key twice.

What did you see instead? Under which circumstances?

No error, empty returned data set.

Environment

  • System information:
Linux 3.16.7-ckt11+soundcloud x86_64
  • Prometheus version:
prometheus, version 1.5.2 (branch: master, revision: bd1182d29f462c39544f94cc822830e1c64cf55b)
  build user:       root@a8af9200f95d
  build date:       20170210-14:41:22
  go version:       go1.7.5
  • Prometheus configuration file:
    Not relevant

I'm assuming the code is working correctly -- PromQL filters the metrics according to the two label matchers supplied. Because they're logically excluding the other, the returned set is empty. Seems like a pretty obvious incorrect use-case and returning "Hey, label matchers must be unique, but key was specified more than once" would be a nice-to-have.

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Mar 23, 2017

This seems generally like expected behavior. Label matchers are connected by AND, irrespective of label name.
For equality obviously the result will be empty, but not sure whether it should be an error.

For example, would this seem wrong?

requests_total{status!="404",status!="300"}

@stuartnelson3

This comment has been minimized.

Copy link
Member Author

stuartnelson3 commented Mar 23, 2017

That's a good point. While I would be surprised to see this instead of a regex, there's no reason it shouldn't be allowed.

@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.