LogQL: Logical "OR" on stream selectors

Hello there,

I’d like to understand if there is an idiomatic way to make “OR” / union queries in logql, when (I think) this cannot be achieved with a single stream selector. Such as when you want to run {label1="foo"} OR {label2="bar"} (note distinct labels are used there).

So far, I’ve been doing queries duplication & merge in order to do that, which is quite painful. Like doing in parallel {label1="foo"} and {label2="bar"}, and merging the results, having to eliminate duplicates.

I’ve seen that the “or” union works on vectors only, e.g. rate({label1="foo"}[1m]) OR rate({label2="bar"}[1m]) would work, but it doesn’t when removing the rate function ie. when not asking for metrics.

To avoid eliminating duplicates we can run {label1="foo"} and {label1!="foo",label2="bar"} , but it still requires running multiple queries & merging