How to sort tables in stream tables (for visualization in Grafana state timeline plugin)

Hello, here is the basic starting graph

In Grafana, I have a state time line graph with N series (tables) and I would like reorder the series according to a rate of occupancy. Each line is a stream of “busy” (red) - “free” (green).

Data come from influxdb and are processed using flux

For each serie, I compute the percentage of time it is in the busy state. I get a result from 0 to 100%. I have been able to show the percentage in the ascendant order on the right of the picture

BUT, I don’t know how to reproduce this on the left part of the figure. How to tell the state time line to sort the series in the ascendant order according to this computed percentage. sort() is used inside a single serie

The idea is to get an easy representation from low usage to high usage

Any idea how to sort those series ?

(also posted on the grafana forum …)

Thanks, have a good day.

Hello @grab06,
Did you specify the right column when using the sort() function?
Outside of hat I don’t know if I can help you because InfluxDB doesn’t have that type of visualization.
Also maybe a group() function would do the trick? Group by rate or occupancy? I’m not sure.

Hello Anais, thanks for your reply,

to me,

  • sort() will not help because I want to sort across tables and not inside a table.
  • group() will me make loose the multiple series entities for one single big serie that will not fit the graph

I’m wondering, would it be possible to group, tweak the single serie to generate … kind of a new naming … and then de-group into several series with this new names that will rearrange the series then … ?

Hello @grab06,
Maybe share your query that’s generating the graph so far?
Im out of my element because InfluxDB doesn’t support this visualization.
Yes I was thinking you’d group and then ungroup data as needed.

Hello Anais, as you said, the graph is Grafana specific, I’ve posted on the Grafana forum also and I’ll come back to you if I get any answer, hint from this other side.

Basically, the question could be resumed at:

is it possible to rename a tag in influxdb ?

Searching over the internet shows me this is a recurrent question that I think still has no answer, so I guess renaming the tag is not possible as of today. Am I correct saying that?

Thanks, have a good day.


Hello @grab06,
You are largely correct.
You can Flux to rename a tag key or value with the following functions:

But usually what we recommend to anyone wanting to change their schema is that they just start writing new points in their desired schema or tag values and then let the old tags expire with the retention policy.