Value of _measurement from result of flux query is not available

  • What Grafana version and what operating system are you using?

7.5.15/Fedora

  • What are you trying to achieve?

I query some data from influxDb using this query:

from(bucket: v.bucket)
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["host"] == "${host}")
  |> filter(fn: (r) => r["device"] == "interface")
  |> filter(fn: (r) => r["_field"] == "if_octets.rx" or r["_field"] == "if_octets.tx")
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> yield(name: "mean")

Note that there is no filter on “_measurement”, because I need the values of _measurement in the label of the result.

Without any renaming, the result looks good. It has the value of _measurement, a space, the value of the value and additional information in curly braces. What’s different from all the queries I’ve authored before is that I have two “ids” in front of the opening curly brace, but well…

Now I want to have the value of _measurement (first id/word) as label.

  • How are you trying to achieve it?

I use rename by regex.

  • What happened?

But when I add this transformation, the first id/word in the result vanishes. So despite having “(.*)” → “$1” (which should leave the result as it is), the value of _measurement is gone. The labels in the graph change from “_measurement value { … }” to “value { … }”

  • What did you expect to happen?

Labels shouldn’t change until I apply my regex and the value of _measurement should be available when matching. There seems to be no possibility to add the value of _measurement to the resulting label.