Why is my PromQL queries not merging in Grafana

939 views Asked by At

I have two metrics of type count:

metric1(instance="", instance_ip="")
metric2(instance="", instance_ip="")

I'm having troubles when I try to display both on Grafana via table:

  • Query:
v A
  Metrics: metric1_total + 0
v B
  Metrics: metric2_total + 0

Note: I added 0 to remove __name__ in the column

  • Expectation:
time           instance         instance_ip    Metric1 Value    Metric2 Value
Jan-1-2020     0.0.0.0:8000      0.0.0.0             1                2
  • Reality:
time           instance         instance_ip    Metric1 Value
Jan-1-2020     0.0.0.0:8000      0.0.0.0             1   
[ instance, instance_ip, Metric2 Value                       v ]
NOTE: ^--> This is a dropdown in Grafana

Grafana isn't automatically merging the values of metric1 and metric2.

1

There are 1 answers

1
Marcelo Ávila de Oliveira On BEST ANSWER

This should do the trick:

  1. Click on the "Transform" tab

  2. Click on the "Add transformation" button

  3. Choose "Outer join" option

  4. Fill the "Field name" field with "instance"