Dynamic measurement naming

Hi everyone,

I’m struggling with a visualization issue where my metadata (zone name) changes over time, while the unique identifier (zone ID) remains the same.

Raw data example: Measurement,zone=1 Act_Temp=20.530,name="Barrel_1"

The scenario: I want to filter and display my measurements by zone. However, the name associated with that zone can change (e.g., from “Barrel_1” to “Barrel_2”).

The problem:

  • If I group by name, the data gets separated into two different series in my graphs as soon as the name changes.

  • If I group by zone, the data stays together as one continuous line, but I lose the friendly name in the legend or alias.

My goal: I want the measurement to stay the same (continuous line) but have the legend/alias update dynamically to the most recent name provided for that zone.

How can I achieve this without splitting the data series?

Thanks in advance!

Hi @kwi1 ,
Grafana treats every unique series label as a separate line, so it assumes it’s a completely new series and splits the graph.

don’t use the changing name field as the grouping key. Instead, group your data using the stable zone id, since that never changes. Then, fetch the latest name for that zone separately and attach it back only for display purposes.

Before -

After -

Anything else, Please let me know.

Hi @infofcc3 , thanks for the response! I don’t quite understand how you’re getting the name as an alias without filtering, especially since there can be multiple zones in a single graph. Could you share the query you used? Thanks again!

if i use following queries in combination with a transformation i can get the last name of the measruement, but when there are multiple zone’s in 1 graph it doesnt work

queries;

transformation;

multiple zone problem-

zone 1;

zone 1&2;

the correct '“barrel_4” name for zone 1 turns in the latest zone 2 name - “barrel_7”.