Grafana shows `504 Gateway Timeout` on long-range queries
AdvancedTroubleshootingGrafana dashboards and data sources
Answer
Likely causes → The query outlasts the data source timeout, the Grafana [dataproxy] timeout (default 30s), or an ingress/load balancer idle timeout.
Diagnose → Query inspector shows request duration; check ingress annotations and Grafana logs.
Fix → Optimise the query (recording rules), raise the data source Timeout field and [dataproxy] timeout, and the ingress proxy-read-timeout.
Prevent → Keep heavy long-range views on downsampled data (Thanos/Mimir).
More on Grafana dashboards and data sources
Every panel on a dashboard shows `No data`BeginnerGrafana data source test fails with `Bad Gateway` (HTTP 502)BeginnerData source test returns `Post "http://prometheus:9090/api/v1/query": dial tcp: lookup prometheus on 10.96.0.10:53: no such host`BeginnerGrafana behind a reverse proxy shows `If you're seeing this Grafana has failed to load its application files`BeginnerGrafana login loops back to the login page after successful OAuthIntermediateGrafana pod logs `database is locked` and dashboards fail to saveIntermediate