New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort series on X axis #13325
Comments
The order in which series are drawn is the same as the order returned by your Prometheus query, you need to sort your series in your query. |
That's a great idea, do you know a way to do it? From what I can tell, Prometheus doesn't support it: |
Apparently sorting in Grafana works if |
@torkelo can this be reopened? |
@torkelo sorting by anything other than the value is still not supported in PromQL and from what I read in the following issue, it doesn't seem like they want to add this as they think this is a presentation feature which should rather be available in Grafana.
|
I check the Prometheus implementation, it only sort series for range query. Prometheus need to support |
Bumping this for visibility. This would be very useful, as Prometheus has closed the PR linked above without merging it. It appears they believe Grafana should implement this sort of functionality. |
Sorting data of a time series in the Prometheus query sorts each time bucket returned from Prometheus. But when the X-Axis is set to "Series" with a "Total" aggregation function (part of Grafana) it is not really possible to sort this in the query like this. |
This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions! |
This is still relevant I suppose. |
Prometheus gained support for label sorting for instant queries: I also added natural sorting there: I haven't tested it with Grafana, but it might just work these days. |
What Grafana version are you using?
5.2.3
What datasource are you using?
Prometheus
What did you do?
Set Graph X axis mode to "Series" to see CPU load distribution between cores.
What was the expected result?
Cores are sorted by their name:
cpu00
,cpu01
, ...,cpu31
What happened instead?
Cores are randomly sorted on each refresh:
Query is:
If X axis is time, then the legend is sorted properly:
The text was updated successfully, but these errors were encountered: