Sorting wildcard series

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

v8.0.3

  • What are you trying to achieve?

I have multiple series coming from a single data source, and Id like to be able to control the order of these series in the graph, as my graph is stacked. I've only got 2 series, and, by default, they are alphabetical. Id like to reverse this, although knowing how to do an arbitrary order would also be useful.

I was hoping that I`d be able to do something about this in the panel options rather than the query, but I couldn’t find anything in either Graph (old) or Time Series

  • How are you trying to achieve it?

My current query (to Graphite) is:
aliasByNode(sumSeriesWithWildcards(exclude(a.b.c.d.*.*.g, 'pending'), 4), 4)
This is giving series labels based on the * that is in the “f” position, in alphabetical order.

I tried adding a sortByName function around this:
sortByName(aliasByNode(sumSeriesWithWildcards(exclude(a.b.c.d.*.*.g, 'pending'), 4), 4), true)

I tried with both true and false as the parameter.

I found this documentation on Graphite:
https://graphite.readthedocs.io/en/latest/functions.html#graphite.render.functions.sortByName
But the function in Grafana only seems to take a single parameter. Changing it doesn’t seem to make any difference.

  • What happened?

Nothing changed

  • What did you expect to happen?

I was hoping to be able to have my “B” series be on the bottom of the stacked graph and the “A” series be on the top.

  • Can you copy/paste the configuration(s) that you are having problems with?

See above

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

No errors

  • Did you follow any online instructions? If so, what is the URL?