For example if I have two time series like below.
metric_1{id=1} 1
metric_1{id=2} 1
metric_1{id=3} 1
metric_2{id=1} 1
metric_2{id=3} 1
I would like to get this as the query result since id=2 is not in metric_2.
{id=2} 1
Similar to this question Comparison Query to Compare Two SQL Server Tables but in Promql. Thanks for any help.
So you basically want to drop all series in
metric_1that have a value for the labelidthat can be also found in the seriesmetric_2. In SQL this would look something like this:In Prometheus first you might come across
group_left. (read more about this here "Left joins in PromQL". But this will not work. Instead, we use theunlessoperator.