grafana / grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
https://grafana.com
GNU Affero General Public License v3.0
64.7k stars 12.11k forks source link

Dashboard: Unexpected Behaviour with Multiple Query References in Grafana Expressions #78905

Open mmaha-CC opened 11 months ago

mmaha-CC commented 11 months ago

What happened?

When attempting to extend the expression to include more than two queries (e.g.,$B+$F-$C-$E-$D), an issue arises. Instead of displaying the consolidated legend reflecting the total expression, Grafana seems to incorporate the query object or string of the last reference (in this case, $D) into the legend. Screenshot from 2023-11-22 11-40-25

Untitled design (1)

What did you expect to happen?

The legend should accurately represent the cumulative result of the entire expression, reflecting the combination of all referenced queries, i.e., Total Messages Pushed to Queue

Did this work before?

No. When utilizing Grafana expressions involving references to two queries (e.g., $A + $B), the visualization works as expected, and the legend appropriately displays the desired information, such as "Total Messages Pushed to Queue."

However, when attempting to extend the expression to include more than two queries (e.g., $A + $B + $C), the legend would erroneously show details related to the query of $C. This behaviour is not aligned with expectations and can be observed in instances where the expression involves more than two query references.

How do we reproduce it?

  1. Set up a Grafana dashboard with at least three queries, let's call them $A, $B, and $C.
  2. Create an expression involving all three queries (e.g., $A + $B + $C).
  3. Observe the legend associated with the visualisation.

Is the bug inside a dashboard panel?

No response

Environment (with versions)?

Grafana: v10.1.4 OS: Ubuntu Browser: Brave

Grafana platform?

None

Datasource(s)?

No response

tonypowa commented 10 months ago

thank you for creating this issue I have reproduced it following your repro steps exp

Forwarding issue to dashboard squad

kaydelaney commented 6 months ago

This looks like an Expressions issue, so I'm re-assigning to @grafana/observability-metrics

bohandley commented 6 months ago

For investigation, is this impacted by this PR here? Expression: Fix a bug of the display name of the threshold expression result

mmaha-CC commented 2 months ago

Hi, was wondering if there's been any updates on this issue