Help ordering Grafana values (legend)

Greetings!

I am using Influxdb along with Telegraf and the vSphere Input Plugin to visualize data in Grafana and one of my graph keeps track of my CPU utilization. Recently I upgraded my host’s CPU to one with a bigger core count but now the legend is out of order:

82820244-d4fb0300-9e6f-11ea-9782-9563b34bae08

I have tried dropping the measurement responsible from the database (vsphere_host_cpu) and restarting both Influx and Telegraf but it still comes back unordered.

Is there another step I may be missing to correct this? I opened a bug report with Grafana but was told this is a database issue.

Thank you.

Those value are already ordered, not as numbers but as strings and there is nothing you can do about it.
If you really want to have them ordered (tag values are always ordered in an alphanumeric ascending way by default) you need to add the leading zeroe (es: 1 -> 01), this will result in a correct sorting.

Also I suggest you to renae this question to something more on-topic, you are asking how to order the legend of a grafana chart, ot how to drop a measurement

I edited the thread title.

How can I achieve that?

if you are gathering the metrics in a custom way, then I don’t know.
If you are using telegraf try to look at the processor plugins. You should be able to modify the value using enum or regex processors

1 Like

I will try using the processor plugin as recommended but I don’t quite understand why this is even happening. Will it help if I drop the database and re-create it? Why were they in order prior to the upgrade? Sorry if a dumb question but just trying to wrap my head around it.

Dropping the database won’t help in any way everything depends on the data you store in it, if you keep storing the same data you can’t expect the database to treat it differently.

The current problem is very common in any tool when a numeric column gets interpreted as text and sorted, and since all the tags in influxdb are strings I don’t see any issue.

Why the problems presented itself now I cannot know since I have no clue about what the previous situation was