How to use customer graph legend

hi, I am importing some data from Prometheus. The service exporting the metrics looks like:

qbit_dl_bytes 2788376164837
qbit_dl_rate_bytes 0
qbit_ul_bytes 60386210507433
qbit_ul_rate_bytes 3725915
up 1

I am able to write queries to graph exactly what I want, however I wish to change the legend to some custom text, not related to the labels.

Current:

Instead of {instance=....}
I would instead like it to be “UL (MB/s)” and “DL (MB/s)”.

If I enter anything in the text box for “legend format”, the graph (or rather that metric line) just disappears. I’m sure there must be some way to have custom text, just not sure how I can do it (new to Grafana).

Hopefully this is possible without changing anything in my service or Prometheus, since it is just a smal l change of what to display for the query in the legend within Grafana. Thanks

Hi @ckcr4lyf

Can we assume that the values you want to display somehow relate to your queries? Have you tried adding some of the standard field options as values to the legend?

https://grafana.com/docs/grafana/next/panels/standard-options/

Sorry, I meant just to add a custom “user friendly” label along with the colors.

I don’t want to calculate additional values based on the query (like min / max etc.). Right now, in the legend, the color is associated with the “labels” (from Prometheus), I want to override that with just a text value, e.g. “Upload” for green, “Download” for yellow

Sorry, today I tried legend format again and it seems to work. Apologize, my issue is fixed now

image

1 Like

This topic was automatically closed after 365 days. New replies are no longer allowed.