Updating legend using another metrics label

Hello,

I have a visualization that uses Prometheus as a data source.
I’m specially using the snmp_exporter and the metric I’m trying to visualize in disk I/O read.

My query is the following:
“irate(diskIONReadX{job=~‘$job’,instance=~‘$instance’}[$__rate_interval])”

The legend for this includes the following labels:

  • DiskID
  • Job
  • Instance

I would like the legend to reference the DiskIOName which can be found if I refer to this metric “diskIODevice” as it converts the ID into the device name like sda, sdb, etc.

However, since I don’t reference that metric, I’m not sure how to make it use that value instead.

I tried messing around with the labels, variables, filter overrides, and transformation but wasn’t able to figure it out.

Can anyone assist with this?

Thanks.

You need to join 2 metrics. That can be done on the PromQL level usually. See:

Thank you- that worked.