How do you protect the metrics backend from expensive queries?
AdvancedProductionScaling Prometheus, Long-Term Storage & HA
Answer
- Prometheus:
--query.timeout,--query.max-samples,--query.max-concurrency. - Mimir/Thanos: query-frontend splitting and sharding,
max_fetched_series_per_query,max_query_lookback, per-tenant concurrency. - Grafana: data source timeout, panel query limits.
- Separate read paths for dashboards and for rules so a heavy ad-hoc query cannot delay alert evaluation.
Log slow queries (--query.active-query-tracker and Mimir's query stats) and fix the worst offenders with recording rules.
More on Scaling Prometheus, Long-Term Storage & HA
What are the practical limits of a single Prometheus server?IntermediateWhen does hierarchical federation still make sense?IntermediateHow do you shard Prometheus scraping, and what do you lose?AdvancedCompare Thanos, Grafana Mimir and VictoriaMetrics.AdvancedThanos sidecar versus Thanos Receive: how do you choose?AdvancedWhat is Prometheus agent mode and when do you use it?Intermediate