No "ALIAS BY" when using flux?

I’m only doing my first real Flux queries this week, so I won’t claim to understand how this works.

But… It seems that _field is not actually relevant? I used your example to get my panel to work – thanks!!! – and then tinkered and… this worked, too:

 |> map(fn: (r) => ({
      r: r._time,
      c: ${some code to generate the legend label string},
      v: r._value
    })
  )
  |> pivot(rowKey: ["r"], columnKey: ["c"], valueColumn: "v")

:man_shrugging:

You can also use a transform of the type “Rename by regex” to solve this for multiple signals in one query.
Simply create a regex that catches the name you want as a capture group, so you can use the replacement variable $1.

In the first screenshot you see the typical crazy names that we get out of the query.
The second one shows the transform and the result.

3 Likes

I tried to rename with Regex but it does not work. I`m using Grafana 12.0.0 as a Homeassistant Add-On.


I dont know whats wrong. Overrides dont work reliable either, i`m struggling now for hours to get some user friendly display names :frowning:

These examples produce friendly legend names, but mostly use variables. Maybe these will offer some clues.

Sorry, i can’t get it :smiley: I had a lock at the time series but don’t know how to adapt it.
The regex thing would be perfect for my needs, do you have an idea why it doesn’t work? Are there some known issues?