Disabling query builder in Grafana

Is there any way to disable query builder in Grafana?
If users type one or two letter there, series requests kills our Prometheus servers.

That can be avoided by disabling metrics lookup, but issue is that in “Code” mode typing same letter or two doesn’t kills Prometheus as it doesn’t invokes series request somehow.

This might help. https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/#query-editor

That only sets default, allowing users to switch to Builder anyway :disappointed:
And Disable metrics lookup disables autocomplete in Code mode too, which currently works fine and doesn’t causes any issues with Prometheus

have you set your prometheus version and type in the datasource configuration? If your version supports the new label/…/values with the match[] parameter then the query builder won’t use the series endpoint.

Good point, we’re using Thanos 0.31.0 actually, not sure if it supports it. Will try tomorrow

According to https://github.com/thanos-io/thanos/pull/3566, it was merged in 0.18.0. However some people have reported that thanos doesn’t support this endpoint (1, 2), so I would suggesting testing this out by copy/pasting your production datasource instead of modifying your live one, if you are worried about potential disruption.

Also keep in mind, if your database doesn’t support the match[] parameter on these new API calls, you won’t see anything break in the UI, but you will get unexpected results (the labels will never be filtered by the selected metric, so you’ll see labels that aren’t applicable in the current query context).

And lastly, we’re releasing a new UI for the query builder to select metrics, which might help as well. https://grafana.com/blog/2023/06/29/build-better-promql-queries-with-grafanas-metrics-explorer/. It will be on by default in 10.1, but available under the prometheusMetricEncyclopedia feature flag in 9.5+

Hm, seems like it’s much better now. Thank you :raised_hands:

On a sidenote, noticed that in datasource provisoning

prometheusVersion: 2.4.0```
Does nothing in our version (v9.5.1) not sure if that's bug or intended. Thanos / Prometheus version setting works fine though

Hm, I’m able to provision a prometheus data source with that same provisioning, and it’s using the new endpoints. When you say it does nothing, you mean it’s still calling the series endpoint?