Metrics Dashboard: Sort legend items in tooltip based on values

Summary

The tooltip on the metrics dashboards cannot be interacted with or scrolled on. For a chart with many series, the tooltips are very large and the legend items are displayed in the order in which Prometheus returns without any specific order.

In large tooltips, it would be difficult for the user to quickly identify the best and worst performing series. One way this can be solved is by setting an order for the legend values.

Grafana supports None, Increasing and Decreasing. This will be very useful for the metrics dashboard (check PubSub Topic Message Send Rate in https://gitlab.com/gitlab-org/monitor/sandbox/test-metrics-dashboard/-/environments/2115574/metrics?dashboard=.gitlab%252Fdashboards%252Flogging.yml)

Screenshots

- -
Settings in Grafana image
None order image
Increasing order image
Decreasing order image
Metrics dashboard image
Assignee Loading
Time tracking Loading