Tag rename from query

  • What Grafana version and what operating system are you using?
    Grafana 11.1, Ubuntu 20.04

  • What are you trying to achieve?
    I do have influxdb 1.8 using InfluxQL
    I make query where I group by tag:device_id, which returns multiple series. I use timeseries panel to trend value over the time. The legend of panel then shows name of field + tag

I want to change in legend of panel the tag:device_id, which is number to string (name of device). The number of series (tags) can be very big and is growing as more devices are installed over time.

There is another measurement , where is tag:device_id and field called device_name + some additional fields (SW version, uptime,…). So I actually have data to map device_id to device_name but I am unable to get it work in timeseries panel.

Using Override - series name is not doable as number of series is big and not fixed

I can’t figure out SQL query or transformation which would rename tag value based on another query (SQL table like, or timeseries result)

Can someone advise, please.

Martin

  • How are you trying to achieve it?

  • What happened?

  • What did you expect to happen?

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?

You need to join results of queries from those 2 different measurements. But InfluxDB 1.8/InfluxQL doesn’t support join.

But you can join on the Grafana level: create 2 queries from 2 different measurements, then use join transformation (join by device_id), you may need other transformations before/after until you willl have desired result (e.g. organize, …).

Hi Jan,

this is not working…
both queries are time series, even though the second does not need to be as device_id to device_name mapping is time indifferent, and if I will do Join transformation I have to use “time” field as common field and that will get result in time domain. But I need to get multiple series from queryA and only tag “device_id” to be mapped with data from queryB.

Rgds,
Martin

But nothing stops you from massaging data with another transformation before the join transformation so you will have a suitable format for joining. Don’t expect a single transformation to resolve the whole problem. Go step by step and debug each step.

I had a use case where I had 3 different datasource and ~30 transformations :cry: just to join all these different formats into one final table.

1 Like