You just deployed a new release. Latency spikes. You want to know — is this a regression, or was it the same yesterday?
Sure, you can adjust the time range to look at yesterday's data. But then you lose today's view. You can't see both on the same curve, in the same panel, overlaid for direct comparison.
That's the gap: Grafana lets you look at any time range, but not multiple time ranges as overlapping series in one graph.
I built CompareQueries to solve exactly this — overlay time-shifted queries from any datasource in a single panel, so you can visually compare periods side by side.
When You Need This
- Post-deploy validation: Compare latency/error rates from the last 30 minutes vs the 30 minutes before deploy.
- Day-over-day monitoring: Is today's request volume tracking with yesterday? Plot them together.
- Week-over-week trends: Revenue or conversion metrics — same day last week vs now.
- Alerting on drift: Fire an alert when today's value deviates more than X% from the same period last week.
How It Works (5 Steps)
- Set your panel datasource to
-- Mixed --. - Add a CompareQueries query row.
- Select your target datasource (Prometheus, Loki, Elasticsearch, SQL, etc.).
- Build the query using the datasource's native editor — no special syntax needed.
- Add time shifts:
1d,1w,30m, or any custom duration.
The plugin runs the same query for each time shift, aligns the timestamps, and merges everything into one result set.
What Makes It Different
Works with any datasource
Prometheus has offset 1d, but Elasticsearch, Loki, SQL, and others don't have a native time-shift syntax. CompareQueries handles this at the plugin level — pick any datasource, use its native query editor, and add time shifts without rewriting queries.
Grafana 13+ native support
Grafana 13 dropped legacy RefId-style query references. CompareQueries uses the Target Datasource flow that works on Grafana 11, 12, and 13+ without migration headaches.
Grafana Alerting compatible
Time-shifted comparisons aren't just for dashboards. Use them in alert rules — for example, alert when error rate is 2x higher than the same hour yesterday.
More details, installation guide, and dashboard examples on GitHub.
If this saves you time on your dashboards, a ⭐ on the repo helps others discover it. Got a use case or bug? Open an issue — feedback is always welcome.



Top comments (0)