Menu
Open source
Configure queries to block
In certain situations, you might want to control what queries are being sent to your Mimir installation. These queries might be intentionally or unintentionally expensive to run, and they might affect the overall stability or cost of running your service.
You can block queries using per-tenant overrides:
yaml
overrides:
"tenant-id":
blocked_queries:
# block this query exactly
- pattern: 'sum(rate(node_cpu_seconds_total{env="prod"}[1m]))'
# block any query matching this regex pattern
- pattern: '.*env="prod".*'
regex: true
To set up runtime overrides, refer to runtime configuration.
Note
The order of patterns is preserved, so the first matching pattern will be used.
View blocked queries
Blocked queries are logged, as well as counted in the cortex_query_frontend_rejected_queries_total
metric on a per-tenant basis.
Was this page helpful?
Related documentation
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
60 min
Intro to metrics with Grafana: Prometheus, Grafana Mimir, and beyond
In this webinar, we’ll go over challenges when scaling metrics systems, with a particular focus on Prometheus and Grafana Mimir.
Video
Scaling and securing your Prometheus metrics in Grafana Cloud
In this webinar, we’ll go over Grafana Enterprise Metrics (GEM), a simple and scalable Prometheus service that is seamless to use, and simple to maintain
12 min read
Less is more: How Grafana Mimir queries run faster and more cost efficiently with fewer indexes
By avoiding inverted index lookups in the Prometheus TSDB, Mimir's memory usage was reduced by up to 64%.