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

PromQL: Allow label append to groups of metrics #4949

Open
SuperQ opened this Issue Dec 4, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@SuperQ
Copy link
Member

SuperQ commented Dec 4, 2018

Proposal

From an IRC conversation with @ecraven, we had an idea to simplify some expressions by allowing labels to be applied to groups of metrics surrounded by ().

For example:

foo{env="prod"} / bar{label="prod"}

Becomes:

(foo / bar){env="prod"}

The effect for other labels applied to foo and bar would be to append the list of label filters to any interior ones.

For example:

(foo{blah="blah"} / bar{blah="blah"}){env="prod"}

Would translate to:

foo{blah="blah",env="prod"} / bar{blah="blah",env="prod"}
@aixeshunter

This comment has been minimized.

Copy link
Contributor

aixeshunter commented Dec 4, 2018

Good idea 👍

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Dec 4, 2018

I'm not sure about this. Given how the rest of the language works, I'd expect this to evaluate all of foo{blah="blah"} / bar{blah="blah"} and then restrict it down. I'm also generally against features that are merely another way of writing something that we already support.

@SuperQ

This comment has been minimized.

Copy link
Member Author

SuperQ commented Dec 4, 2018

Yes, I agree, it might over-complicate parsing. I just wanted to post the idea, as it seemed interesting and worth having a discussion about.

@ecraven

This comment has been minimized.

Copy link

ecraven commented Dec 5, 2018

The reason I tried this was a form like
((foo - bar - baaz) / foo) where I'd have to repeat the labels four times :-/

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