Sorry, first link was wrong.
https://groups.google.com/g/prometheus-users/c/IeW_3nyGkR0/m/unto0oGQAQAJ
https://groups.google.com/g/prometheus-users/c/83pEAX44L3M/m/E20UmVJyBQAJ

On Friday 19 April 2024 at 18:28:29 UTC+1 Brian Candler wrote:

> Can you give examples of the metrics in question, and what conditions 
> you're trying to check for?
>
> Looking at your specific PromQL query: Firstly, in my experience, it's 
> very unusual in Prometheus queries to use ==bool or >bool, and in this 
> specific case definitely seems to be wrong.
>
> Secondly, you won't be able to join the LH and RH sides of your expression 
> with "and" unless either they have exactly the same label sets, or you 
> modify your condition using "and on (...)" or "and ignoring (...)".
>
> "and" is a vector intersection operator, where the result vector includes 
> a value if the labels match, and the value is taken from the LHS, and that 
> means it doesn't combine the values like you might be used to in other 
> programming languages. For example,
>
> vector(0) and vector(1)  => value is 0
> vector(1) and vector(0)  => value is 1
> vector(42) and vector(99)  => value is 42
>
> This is as described in the documentation 
> <https://prometheus.io/docs/prometheus/latest/querying/operators/#logical-set-binary-operators>
> :
>
> vector1 and vector2 results in a vector consisting of the elements of 
> vector1 for which there are elements in vector2 with exactly matching 
> label sets. Other elements are dropped. The metric name and values are 
> carried over from the left-hand side vector.
>
> PromQL alerts on the presence of values, and in PromQL you need to think 
> in terms of "what (labelled) values are present or absent in this vector", 
> using the "and/unless" operators to suppress elements in the result vector, 
> and the "or" operator to add additional elements to the result vector.
>
> Maybe these explanations help:
> https://groups.google.com/g/prometheus-users/c/IeW_3nyGkR0/m/NH2_CRPaAQAJ
> https://groups.google.com/g/prometheus-users/c/83pEAX44L3M/m/E20UmVJyBQAJ
>
> On Friday 19 April 2024 at 16:31:23 UTC+1 Robson Jose wrote:
>
>> Good afternoon, I would like to know if it is possible to do this query, 
>> the value that should return is applications with a value of 0 in the first 
>> query and greater than one in the 2nd
>>
>> (
>>   sum by (consumergroup, topic) 
>> (delta(kafka_consumergroup_current_offset{}[5m])/5) ==bool 0
>> ) 
>> and (
>>   sum by (topic) (delta(kafka_consumergroup_current_offset{}[5m])/5) 
>> >bool 1
>> )
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/304a4437-6cbb-451b-b476-d3196dc6923bn%40googlegroups.com.

Reply via email to