Pie Chart visualization displays the query as a value in the legend

  • What Grafana version and what operating system are you using?
    Grafana 9.1.6 running in the official docker image grafana/grafana:9.1.6

  • What are you trying to achieve?
    I have built a pie chart from a metric. Everything is fine with the exception that the literal query is displayed as another value in the legend.

  • How are you trying to achieve it?
    The query is: sum by (key1) (increase(my_metric)[10y])

  • What happened?
    This query is shown as part of the legend.

  • What did you expect to happen?
    Legend only shows the sum by keys.

This happens when there is an empty value in the label. For instance, let’s say you have a metric my_metric{l1="", l2="test2"}. Then l1="" will be displayed as the query because there is no value.

Even thought this can be prevented, I don’t think this is the correct way to handle it.