Grafana Mixed Data Sources

Real questions rarely live in one system. Server load sits in Prometheus, orders sit in a MySQL database, and errors sit in Loki. A Mixed data source lets a single panel pull from several systems at once. You compare numbers that normally stay apart and see the connection between them.

The Meeting Room Analogy

Picture a meeting where the IT lead, the sales lead, and the support lead all present their numbers on one shared screen. Everyone sees how server slowdowns line up with fewer orders and more support tickets. A Mixed panel works like that shared screen. Each query comes from a different expert, and all answers appear on one chart.

+--------------+   +--------------+   +--------------+
| Prometheus   |   | MySQL        |   | Loki         |
| response ms  |   | orders/min   |   | error count  |
+------+-------+   +------+-------+   +------+-------+
       |                  |                  |
       +--------+---------+---------+--------+
                |   Mixed panel     |
                +-------------------+

Create a Mixed Panel

  1. Add a new panel to a dashboard.
  2. Open the data source picker at the top of the query editor.
  3. Choose -- Mixed -- at the bottom of the list.
  4. Click the first query row, pick a data source for it, and write the query.
  5. Click Add query.
  6. Pick a different data source for the new row and write its query.

Every query row shows its own data source name, so you always know where each series comes from.

A Practical Sample

An online shop wants to see whether slow pages hurt sales. The team builds one time series panel with two queries.

QueryData SourceQuestion
APrometheusWhat is the average page response time?
BMySQLHow many orders arrive each minute?
Response time (ms)  vs  Orders per minute

 ms |        ____
    |   ____/    \____          Response time (left axis)
    |__/              \___

 /min|  ____             ____
     | /    \___    ____/       Orders (right axis)
     |/         \__/
     +------------------------
        10:00   10:30   11:00

When response time rises, orders fall. The chart tells the story at a glance, with no spreadsheet work.

Match the Scales

Different systems use different units. Response time runs in hundreds, and orders run in tens. One axis cannot show both well. Use an override to move a series to the right axis.

  1. Open the panel editor and scroll to Overrides.
  2. Click Add field override.
  3. Choose Fields with name and select the series.
  4. Add the property Axis placement and set it to Right.

Set a unit for each series in the same override list, such as milliseconds for one and a plain count for the other.

Align Time

Each data source records time in its own rhythm. Prometheus might sample every 15 seconds, and a SQL query might group by minute. Group the SQL data into the same bucket size as the other series. Use the macro $__timeGroup(created_at, '1m') in the SQL query, and keep your Prometheus step close to one minute. Aligned buckets produce lines that rise and fall together.

Combine Results Into a Table

Transformations merge results from different queries. Open the Transform tab and add Join by field. Select Time as the join field and pick OUTER (TIME SERIES) as the mode. Grafana builds a table with one row per timestamp and one column per series.

Time    | Response (ms) | Orders
--------+---------------+--------
10:00   |      120      |   42
10:01   |      135      |   40
10:02   |      410      |   18

Use Another Query as a Source

The special -- Dashboard -- data source reuses the result of a query from another panel on the same dashboard. A Mixed panel can include such a row. This approach saves time and reduces load on busy systems.

Limits to Keep in Mind

  • Mixed panels cannot use features that belong to one data source only, such as query inspector helpers for a specific language.
  • Each added query adds load time, since every query runs separately.
  • Dashboard variables must work for every data source in the panel. A variable that filters Prometheus labels does nothing for a MySQL query unless you write the variable into the SQL.

When to Use Mixed Panels

SituationUse Mixed?
Compare technical health with business resultsYes
Overlay a deployment history from a database on a metrics chartYes
Show two metrics from the same PrometheusNo, one data source handles it
Build a dashboard with unrelated chartsNo, use separate panels