Skip to content

Quick‐Start

leoswing edited this page May 25, 2026 · 1 revision

Quick Start

This guide helps you create your first comparison chart with CompareQueries in Grafana.

Prerequisites

  • Grafana installed and running
  • CompareQueries plugin installed:
    • Plugin ID: leoswing-comparequeries-datasource
  • A target datasource already available in Grafana (for example Prometheus, Loki, Elasticsearch, MySQL, PostgreSQL)

1. Add CompareQueries datasource

  1. Open Connections -> Data sources.
  2. Click Add data source.
  3. Search for CompareQueries.
  4. Save and test.

2. Configure datasource authentication (optional)

Default setting is usually enough:

  • Authentication: No Authentication

Only switch to Basic authentication when backend or alerting requests fail due to auth issues:

  • Set Service Account Token
  • Set Grafana URL only if auto-detection is incorrect

3. Create a dashboard panel

  1. Open or create a dashboard.
  2. Add a new panel.
  3. Set panel datasource to -- Mixed --.
  4. Add a query row and choose CompareQueries as the row datasource.

4. Build comparison query

Inside CompareQueries query editor:

  1. Choose Target Datasource.
  2. Build your target query using the native editor.
  3. Add one or more Time-shift rows:
    • 1d for yesterday
    • 1w for last week
    • 30m for 30 minutes earlier
  4. (Optional) Enable Process TimeShift if you want shifted series aligned to the current time window.

5. Alias and legend (optional)

Use alias fields to make legends easy to read, for example:

  • current
  • yesterday
  • last_week

6. Save and verify

  • Save the panel and dashboard.
  • Confirm multiple shifted series are displayed in the same chart.

Notes by Grafana version

  • Grafana 13+: Use the Target Datasource flow (recommended and required for new dashboards).
  • Grafana 11/12 existing dashboards: Legacy RefId workflow can still work, but new dashboards should use Target Datasource flow.

Next steps

  • For alerting setup, see the Alerting page.
  • For migration from legacy RefId queries, see the Migration Guide page.
  • For local development and debugging, see Developer Guide.

Clone this wiki locally