multiply used labels in filters

592 views
Skip to first unread message

Henri Dubois-Ferriere

unread,
Aug 10, 2018, 3:02:59 PM8/10/18
to prometheus...@googlegroups.com
When I use a label multiple times in a filter, they are all applied (as though they were implicitly ANDed together).

In other words, if I ask for:
   metric{a=~x, a!=y}
I get all the metrics where a=~x AND a!=y.

So my question is: should this considered as part of the promql "specification"? 

In particular, should a remote read implementation handle repeated matchers in this way?

Henri

Brian Brazil

unread,
Aug 10, 2018, 5:24:25 PM8/10/18
to Henri Dubois-Ferriere, Prometheus Developers
On 10 August 2018 at 20:02, Henri Dubois-Ferriere <hen...@gmail.com> wrote:
When I use a label multiple times in a filter, they are all applied (as though they were implicitly ANDed together).

In other words, if I ask for:
   metric{a=~x, a!=y}
I get all the metrics where a=~x AND a!=y.

So my question is: should this considered as part of the promql "specification"? 

 
In particular, should a remote read implementation handle repeated matchers in this way?

Yes, it should. 

--

Henri Dubois-Ferriere

unread,
Aug 10, 2018, 5:28:59 PM8/10/18
to Brian Brazil, prometheus...@googlegroups.com
Ok thanks.
(Btw I had read that page and just re-read it again, but don't see anything that mentions multiple selectors.)

Brian Brazil

unread,
Aug 13, 2018, 3:39:33 AM8/13/18
to Henri Dubois-Ferriere, Prometheus Developers
On 10 August 2018 at 22:28, Henri Dubois-Ferriere <hen...@gmail.com> wrote:
Ok thanks.
(Btw I had read that page and just re-read it again, but don't see anything that mentions multiple selectors.)

It's implied, but not very clear. https://github.com/prometheus/prometheus/pull/4492 out to improve it.

Brian
 

On Fri, 10 Aug 2018 at 14:24, Brian Brazil <brian.brazil@robustperception.io> wrote:
On 10 August 2018 at 20:02, Henri Dubois-Ferriere <hen...@gmail.com> wrote:
When I use a label multiple times in a filter, they are all applied (as though they were implicitly ANDed together).

In other words, if I ask for:
   metric{a=~x, a!=y}
I get all the metrics where a=~x AND a!=y.

So my question is: should this considered as part of the promql "specification"? 

 
In particular, should a remote read implementation handle repeated matchers in this way?

Yes, it should. 

--



--
Reply all
Reply to author
Forward
0 new messages