Interview Prep/Monitoring & Observability/PromQL and recording rules

A Grafana panel and the Prometheus UI show different values for the same query

IntermediateTroubleshootingPromQL and recording rules
Answer

Likely causes → Different step: Grafana computes step from the panel width and Min interval, which changes how rate() windows align; or Grafana is querying a different data source / Thanos with downsampling.

Diagnose → In Grafana Query inspector check the actual step, start, end, and the data source URL.

Fix → Use $__rate_interval, set Min interval to the scrape interval, and confirm the data source.

Prevent → Document data sources clearly in dashboard descriptions.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on PromQL and recording rules