On Saturday 24 February 2024 at 01:00:57 UTC+7 Alexander Wilke wrote:

Another possibility could be

QueryA + queryB == 0  #both down


No, that doesn't work, for exactly the same reason that "QueryA and QueryB" 
doesn't work.

With a binary expression like "foo + bar", each side is a vector, and each 
element of the vector has a different label set.

The result only combines values from the left and right hand sides with 
*exactly* matching label sets.  Therefore, an element in the LHS with 
{HOSTNAME="server1"} does not match an element in the RHS with 
{hostname="server2"}.  Elements in the LHS which don't match any element in 
the RHS (and vice versa) are dropped.

But you can modify that logic, using for example "foo + ignoring(HOSTNAME) 
bar"

In this case, the HOSTNAME label is ignored when matching the LHS and RHS. 
But if an element on the LHS then matches multiple on the RHS, or vice 
versa, there will be an error.  N:1 or 1:N matches can be made to work by 
adding group_left or group_right clauses. If multiple elements on LHS match 
multiple elements on the RHS, then that doesn't work.

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/c780eea5-d842-404b-a04c-02558163eafbn%40googlegroups.com.

Reply via email to