0

I have two different Prometheus queries :

Input

product_description{id="1", quantity="12"} 2
product_status{id="1", status="online"} 1

Desired outupt

{id="1", quantity="12", status="online"} 2


What is the Prometheus query to obtain the equivalent of a MySQL join, to merge the labels of the two queries on the id label ?

Edit
Thanks to @MichaelDoubez

product_description{id="1"} + on(id) group_left(status) (0 * product_status{id="1"})
neophat
  • 187
  • 1
  • 10
  • Those are not metrics: you are missing the value and the value is hidden in a label. Do you mean `product_quantity{id="1"} 12` and `product_status{id="1"} 1` ? – Michael Doubez Feb 13 '20 at 12:52
  • 1
    Does this answer your question? [How can I 'join' two metrics in a Prometheus query?](https://stackoverflow.com/questions/44461801/how-can-i-join-two-metrics-in-a-prometheus-query) – Michael Doubez Feb 13 '20 at 12:58
  • @MichaelDoubez Indeed, I edited it. And the link you provided solved my problem. I overlooked it the first time I saw it and couldn't get it working at the time. But now it's all good, thanks ! – neophat Feb 14 '20 at 07:32

0 Answers0