grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
24.04k stars 3.47k forks source link

Multi-value dashboard variable value gets malformed in Loki query with equality operator #15151

Open timtofan opened 2 days ago

timtofan commented 2 days ago

Describe the bug Multi-value dashboard variable value gets malformed in Loki query with equality operator. More specifically, value a.b is inserted into query as a\\.b.

Issue only happens if "selection options: multi-value" or "selection options: all" is enabled. I checked variable type "custom" and type "query to loki datasource with label values lookup", issue reproduces in both cases. For simplicity, screenshots are using type custom.

To Reproduce

Expected behavior Variable value is not malformed in the query, specifically should be a.b in used example.

Environment: Tested both on Grafana Cloud 10 and Grafana Cloud 11, issue reproduces in both cases. Datasource is to Loki OSS v3.1.

Screenshots Image Image Image

timtofan commented 2 days ago

A working fix is to use =~ instead of =. But maybe some warning could be shown if = is not supported for multi-value variables?