Metric selection is broken since upgrade to Grafana 12

Hello

I’m running Grafana v12.2.0 on OpenBSD 7.8.

I want to display metrics from my VictoriaMetrics database using the compatible Prometheus data source. Before upgrading from OpenBSD 7.7 and Grafana 11.5.2, everything worked ok. I’m using a Prometheus data source because VictoriaMetrics is only available on Linux/Windows/Darwin.

From the dashboard visualization query builder, I select a metric using the Metric field, for example collectd.cpu.count. The generated query is {"collectd.cpu.count", plugin="cpu"} which causes an error:


labelFilterExpr: unexpected token "\"collectd.cpu.count\""; want "ident"; unparsed data: "\"collectd.cpu.count\", plugin=\"cpu\"}"

If I switch to “Code” and enter collectd.cpu.count{plugin="cpu"}, the query works and everything is displayed properly.

I have tried restarting Grafana, refreshing my Librewolf cache and use a private navigation but none solve my issue. I also tried various Prometheus versions in the data source configuration but that doesn’t change anything either.

All my dashboards still work. But if I try to select a new metric using the builder, it just fails because the generated query is something like {"collectd.cpu.count", plugin="cpu"}rather than collectd.cpu.count{plugin="cpu"}.

Any idea how to solve this?

Thanks.

1 Like

Hello! {"collectd.cpu.count", plugin="cpu"} is a valid query for VictoriaMetrics and Prometheus starting from VictoriaMetrics@v1.110.0 and Prometheus@v3.0. Please verify that you run VictoriaMetrics of version v1.110 or higher.

2 Likes

Hello. I’m experiencing the same query formatting issue after updating Grafana. The Metric Builder generates the wrong query: {"metric", tag="value"} instead of the correct PromQL format: metric{tag="value"}. This happened to me while using Mimir as the data source. It seems to be a compatibility bug with the Prometheus/Mimir plugin and the new Grafana version.

You’re right.

For some reasons, I was still using victoriametrics-1.109.1.
After upgrading to victoriametrics-1.119.0, the problem is solved.

Thanks a lot.