<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: liang finley</title>
    <description>The latest articles on DEV Community by liang finley (@liang_finley_1abaa5683729).</description>
    <link>https://dev.to/liang_finley_1abaa5683729</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3932772%2F1cbb29a2-9978-4336-938c-604341e9e60a.png</url>
      <title>DEV Community: liang finley</title>
      <link>https://dev.to/liang_finley_1abaa5683729</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/liang_finley_1abaa5683729"/>
    <language>en</language>
    <item>
      <title>Time-Shifted Metric Comparison in Grafana Across Any Datasource</title>
      <dc:creator>liang finley</dc:creator>
      <pubDate>Fri, 15 May 2026 08:59:45 +0000</pubDate>
      <link>https://dev.to/liang_finley_1abaa5683729/how-to-make-time-shifed-compare-metrics-in-grafana-across-datasources-3d8n</link>
      <guid>https://dev.to/liang_finley_1abaa5683729/how-to-make-time-shifed-compare-metrics-in-grafana-across-datasources-3d8n</guid>
      <description>&lt;p&gt;You just deployed a new release. Latency spikes. You want to know — is this a regression, or was it the same yesterday?&lt;/p&gt;

&lt;p&gt;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 &lt;strong&gt;same curve, in the same panel&lt;/strong&gt;, overlaid for direct comparison.&lt;/p&gt;

&lt;p&gt;That's the gap: Grafana lets you look at any time range, but not &lt;strong&gt;multiple time ranges as overlapping series in one graph&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;&lt;a href="https://github.com/leoswing/comparequeries-datasource-rc" rel="noopener noreferrer"&gt;CompareQueries&lt;/a&gt;&lt;/strong&gt; to solve exactly this — overlay time-shifted queries from any datasource in a single panel, so you can visually compare periods side by side.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F883xgz29ccktdf7jqtmx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F883xgz29ccktdf7jqtmx.png" alt="CompareQueries in action" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  When You Need This
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Post-deploy validation&lt;/strong&gt;: Compare latency/error rates from the last 30 minutes vs the 30 minutes before deploy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Day-over-day monitoring&lt;/strong&gt;: Is today's request volume tracking with yesterday? Plot them together.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Week-over-week trends&lt;/strong&gt;: Revenue or conversion metrics — same day last week vs now.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alerting on drift&lt;/strong&gt;: Fire an alert when today's value deviates more than X% from the same period last week.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How It Works (5 Steps)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Set your panel datasource to &lt;code&gt;-- Mixed --&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add a &lt;strong&gt;CompareQueries&lt;/strong&gt; query row.&lt;/li&gt;
&lt;li&gt;Select your target datasource (Prometheus, Loki, Elasticsearch, SQL, etc.).&lt;/li&gt;
&lt;li&gt;Build the query using the datasource's &lt;strong&gt;native editor&lt;/strong&gt; — no special syntax needed.&lt;/li&gt;
&lt;li&gt;Add time shifts: &lt;code&gt;1d&lt;/code&gt;, &lt;code&gt;1w&lt;/code&gt;, &lt;code&gt;30m&lt;/code&gt;, or any custom duration.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The plugin runs the same query for each time shift, aligns the timestamps, and merges everything into one result set.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F09vphs8jz3fhcttr1aqv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F09vphs8jz3fhcttr1aqv.png" alt="Panel setup with Mixed datasource" width="800" height="679"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Makes It Different
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Works with any datasource
&lt;/h3&gt;

&lt;p&gt;Prometheus has &lt;code&gt;offset 1d&lt;/code&gt;, 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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Grafana 13+ native support
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  Grafana Alerting compatible
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk9v9lvq1zz9mev491y0x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk9v9lvq1zz9mev491y0x.png" alt="Alert configuration" width="800" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More details, installation guide, and dashboard examples on &lt;strong&gt;&lt;a href="https://github.com/leoswing/comparequeries-datasource-rc" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;If this saves you time on your dashboards, a ⭐ on the repo helps others discover it. Got a use case or bug? &lt;a href="https://github.com/leoswing/comparequeries-datasource-rc/issues" rel="noopener noreferrer"&gt;Open an issue&lt;/a&gt; — feedback is always welcome.&lt;/p&gt;

</description>
      <category>grafana</category>
      <category>timeshift</category>
      <category>datasource</category>
      <category>observability</category>
    </item>
  </channel>
</rss>
