Nesting query in promQL

Viewed 1230

I am looking for the output of metric 'prom_metric2' where input label is 'label2' the value of which has to be taken from metric 'prom_metric1'.

i.e. for followng input query:

prom_metric1{label1="A"}

Output time series is :

prom_metric1{label1="A",label2="B",label3="C"}
prom_metric1{label1="A",label2="D",label3="E"}

Now, the following metric should take all the values of label2 from above time series and then show the output.

prom_metric2{label2="LABEL_FROM_PROM_METRIC1 i.e. B and D"}

It is equivalent to following SQL query :

Select * from prom_metric2 where label2 IN (Select label2 from prom_metric1 where label1='A')

Is this possible in promQL?

Thanks in advance.

1 Answers
Related