Plugins 〉CompareQueries


Developer

leoswing

Sign up to receive occasional product news and updates:



Data Source
community

CompareQueries

  • Overview
  • Installation
  • Change log
  • Related content

CodeQL

Overview

This data source plugin enables data comparison capabilities by supporting queries from multiple data sources. It allows you to use custom time shifts to display data from different time ranges within a single graph.

Key features:

  • Compatible with Grafana 11/12/13+
  • Resolves issues with undefined data points
  • Introduces support for timeShift aliases
  • Supports Grafana Alerting through backend execution

Plugin-snapshot

Quick start

Step 1. Add the real target datasource you want to compare, such as Elasticsearch. CompareQueries does not store metrics by itself; it runs queries against this target datasource.

Step 2. Create a datasource of type CompareQueries.
Grafana -> Connections -> Data sources -> Add new data source -> search compare.

Screenshot-create-db

Step 3. Configure CompareQueries datasource settings.

  • Authentication (Optional) defaults to No Authentication
  • Switch to Basic authentication only when backend or alerting requests fail authentication
  • Fill Service Account and optional Grafana URL only in that case

Screenshot-datasource-settings

Step 4. Create a dashboard panel and set panel datasource to -- Mixed --.

Step 5. Add a query row and select CompareQueries as that row's datasource.

Step 6. Pick Target Datasource inside CompareQueries, build target query inline, and add time shift rows (Amount like 1d, 1w, etc.).

Screenshot-plugin-usage-mixed

Legacy RefId usage (Grafana < 13 existing dashboards only)

Use this only if you are on Grafana versions below 13 and already have dashboards using the old CompareQueries RefId workflow.

  • Query A: build normal source query (e.g. Elasticsearch)
  • Query B: use CompareQueries and reference Query A by RefId
  • Keep panel datasource as -- Mixed --

For Grafana 13+, use Step 4 recommended flow instead: select Target Datasource inside CompareQueries.

Grafana Alerting (2.1.0+)

Alerting uses backend execution. Alert rules do not use the panel -- Mixed -- datasource flow. Configure CompareQueries directly with Target Datasource, Time shift, and query inline.

  • Default datasource auth mode is No Authentication.
  • If backend or alerting requests fail authentication, switch to Basic authentication.
  • In Basic authentication, configure Service Account token and (optionally) Grafana URL.

Reference alert rule setup (query + condition):

Screenshot-alert-config

Install on Grafana Cloud

Plugins can be installed directly from within your Grafana instance or automated using the Cloud API or Terraform.

Learn more about plugin installation

For more information, visit the docs on plugin installation.

Changelog

v2.1.0 (2026-05-13)

Full Changelog

  • chore: optimize release github workflow #29 (leoswing)
  • feat: optimize backend httpClient and frontend style sttings #28 (leoswing)

2.1.0 (2026-05-08)

Full Changelog

  • Uninstalled after update of Home Assistant #21

  • Issue with compareQueries in Grafana: Missing Queries in Panel #20

  • 多个es query添加compare时,如果时间偏移量一致只显示最后一个compare的数据 #18

  • Unable to add new field from calulation/binary transform a series from CompareQueries #12

  • Dashboards: Comparing with Multiple Fields Results in Identical Field Names in Comparison Output #11

  • Fix/grafana submission scan errors #26 (leoswing)

  • docs: upgrade plugin docs #25 (leoswing)

  • chore: fix release scripts #24 (leoswing)

  • Refactor: add Grafana 13 mixed mode support, and Grafana alert is now available in the plugin #23 (leoswing)

2.0.3 (2024-11-20)

Full Changelog

  • can not have two curves with the same time shift #10

  • fix: fix style in queryEditor #16 (leoswing)

  • fix: fix field name display in absolute mode #15 (leoswing)

2.0.2 (2024-07-10)

Full Changelog

2.0.1 (2024-07-04)

Full Changelog

  • feat: upgrade plugin details during grafana review #9 (leoswing)

2.0.0 (2024-07-03)

Full Changelog

  • Signature: Version 2.0.0 claims to be signed, but it is unsigned #7

  • InfluxDB data source does not show data #2

  • feat: upgrade QueryEditor with grafana ui and fix Query ref unchange … #8 (leoswing)

  • feat: remove hiddenQueries property and upgrade links and screenshots… #6 (leoswing)

  • refactor(plugin): refactor plugin name and config to leoswing-compare… #5 (leoswing)

1.2.0 (2024-06-24)

Full Changelog

  • chore: add sha1 release workflow setting support #4 (leoswing)
  • fix: fix QueryEditor data model binding issue with the form #3 (leoswing)

1.1.0 (2024-06-20)

Full Changelog

  • feat: remove filterQuery to enable with grafana 11 #1 (leoswing)

1.0.0 (2024-06-18)

Full Changelog

* This Changelog was automatically generated by github_changelog_generator