Sorting series based graphs

I would like to visualize series graphs such as the path of a traceroute, where the hop count contains the ordinal number to sort by. When I graph them, the order of the series seems to be sorted ascending or decending by query value.

The topic was similarly commented on 3 years ago with no answer then.

Have there been any feature changes since that address series sorting?

1 Like

I have the same problem, not a single answer in forums thought :frowning:

I use Prometheus and mtr_exporter, I can show the hop ascending with this query:

sort(avg(mtr_latency{alias="$host"}) by(hop_id, hop_ip))

and fill the Legend with this:

hop: {{hop_id}} - IP: {{hop_ip}}

So the traceroute will show as ascending as you want

Thank you.

I am still seeing a sort ascending by value rather than a sort ascending by label (hop_id).

Then again, the traceroute hops by IP look pretty messed up. Are you using mtr_exporter in a prebuilt container, and if so which container on docker hub? I am using ekristen/mtr_exporter.