It would be much easier to help you if you gave real examples, with real
metrics.
The expression you have given can't possibly give "duplicate" entries.
However, you could end up with entries with different sets of labels, e.g.
mymetric{label1="foo",label2="bar"}
mymetric{label1="foo",label2="bar",label3="baz"}
You can most likely use "or on(...)" or "or ignoring(...)" to avoid this
problem - again, it depends on the exact details of your metrics and their
labels.
There are some concrete examples which may help you here:
https://www.robustperception.io/left-joins-in-promql
On Friday, 9 June 2023 at 13:50:09 UTC+1 MohammdReza MollaSalehi wrote:
> Hi everyone
> I want to merge the labels of two query in each other, so I am using this
> query:
>
> *quary1{label_for_both,label_just_in_quary1} *
> ignore(label_just_in_quary1) group_left() quary2{label_for_both}*
>
> After using this query, I found out the entries not in the second query
> were removed, so I added `or` like this quarry:
>
> *(quary1{label_for_both,label_just_in_quary1} *
> ignore(label_just_in_quary1) group_left() quary2{label_for_both}) or
> quary1{label_for_both,label_just_in_quary1}*
>
> As a result, I have duplicate entries anyone has any suggestions to remove
> duplicates?
>
>
--
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/902f9807-c9fb-4669-b2e6-6cd1d5b36dbbn%40googlegroups.com.