> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ewake.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Grafana datasources

> Let ewake query the Prometheus, Thanos, VictoriaMetrics, Loki, Tempo, Jaeger and ClickHouse datasources of your Grafanas.

> [!NOTE]
>
> **What you'll get:** ewake queries your metrics, logs and traces through the datasources already configured in Grafana, during every investigation. You pick which datasources, on one Grafana or several, and you never expose a backend to ewake directly.

***

## Supported datasources

Each kind of backend has its own card on the **Integrations** page. A card lists the Grafana datasources of its type and reads the ones you select.

| Card | Grafana datasource type | Ewake queries with |
| - | - | - |
| [Prometheus](#prometheus) | `prometheus` | PromQL |
| [Thanos](#thanos) | `prometheus`, pointing at Thanos Query | PromQL |
| [VictoriaMetrics](#victoriametrics) | `prometheus`, or the VictoriaMetrics plugin | PromQL |
| [Loki](#loki) | `loki` | LogQL |
| [Tempo](#tempo) | `tempo` | TraceQL |
| [Jaeger](#jaeger) | `jaeger` | Trace search |
| [ClickHouse](#clickhouse) | `grafana-clickhouse-datasource` | SQL |

Every request goes through the Grafana datasource proxy, with the token you give and the credentials each datasource already holds in Grafana.

***

## Prerequisites

* A Grafana instance (Cloud or self-hosted) with the datasources already configured
* A Grafana service account token with the **Viewer** role. On Grafana Enterprise or Cloud with datasource permissions, the account also needs the **Query** permission on each datasource.

> [!TIP]
>
> If you already [connected Grafana](https://docs.ewake.ai/integrations/observability/grafana.md), you don't need a new token: the form offers **Use the key stored for** that Grafana.

***

## Configuration

**1. Open the integration in ewake**

In your ewake dashboard, go to **Integrations** and click the tile of the backend (for example **Loki**) under **Add more**. Once it is connected, its card shows **Configure**.

Or open the **Grafana** card and click **Connect** next to the backend under **Sources in this Grafana**. The form then starts on that Grafana's URL and its stored key.

**2. Enter your Grafana credentials**

| Field | Value |
| - | - |
| **Grafana URL** | Base URL of the Grafana that holds the datasources (e.g. `https://grafana.yourcompany.com`) |
| **API Key** | A service account token, created under **Administration** → **Service Accounts** in Grafana. Or pick **Use the key stored for** a connected Grafana. |

Behind Cloudflare Access or another authenticating proxy, add its headers under **Custom headers**, as for [Grafana](https://docs.ewake.ai/integrations/observability/grafana.md#behind-cloudflare-access-or-a-proxy).

**3. Test the connection and select the datasources**

Click **Test connection**. Ewake lists the datasources of this type in Grafana. Select the ones it may query, see [Select the datasources](#select-the-datasources).

The test then shows, for each selected datasource, what the token can read, with a count and a sample.

**4. Save**

Click **Save**.

> [!TIP]
>
> The datasources are connected. Ewake names the datasource it queries in each call during an investigation.

***

## Select the datasources

* **Select only the datasources of this backend.** Grafana lists Prometheus, Thanos and VictoriaMetrics all with the `prometheus` type, so these three cards list the same datasources. Select each datasource on the card of the backend it really is, so two integrations don't read the same one.
* **A datasource the token can't read is not preselected.** Its row in the test says why, for example the missing **Query** permission.
* **Change the selection later** from the integration's card. A second connect of the same integration on the same Grafana is refused with *already reads this Grafana. Change its datasources from its card.*
* **A deleted datasource** shows up in the health check. Test the connection again and reselect.

***

## Several Grafanas

Each datasource integration can read several Grafanas, one instance for each Grafana. Once it's connected, open its card and use **Add instances** to connect it on another Grafana, with that Grafana's own token.

A datasource keeps its name from Grafana. When two Grafanas have a datasource with the same name, ewake adds the Grafana to the later one's name, for example `Loki US (grafana-us.acme.com)`. The card lists every instance with the datasources it reads.

***

## Backends

### Prometheus

Prometheus, and Prometheus-compatible stores such as Grafana Mimir, through a `prometheus` datasource. Select every datasource ewake may query.

### Thanos

Thanos Query, through a `prometheus` datasource. On a first connect, ewake preselects the datasources whose Prometheus type is set to **Thanos** in Grafana. When none is, it preselects those that answer the Thanos stores API, which plain Prometheus and VictoriaMetrics don't.

### VictoriaMetrics

VictoriaMetrics, through the VictoriaMetrics datasource plugin, or through a `prometheus` datasource pointing at it.

### Loki

Loki logs. The service account needs read access to logs.

### Tempo

Tempo traces, searched with TraceQL.

### Jaeger

Jaeger traces, through a `jaeger` datasource.

### ClickHouse

ClickHouse, through the ClickHouse datasource plugin, with the user each datasource already has. Ewake runs every query read-only. ClickHouse can also connect directly, without Grafana, see [ClickHouse](https://docs.ewake.ai/integrations/observability/clickhouse.md).

***

## Troubleshooting

| Message | Fix |
| - | - |
| *No … datasource is configured in Grafana* | Add the datasource in Grafana, or check you entered the URL of the right Grafana, then test again. |
| *Grafana rejected the API key* | The token is invalid or expired. Create a new one. |
| *Give the service account the Viewer role, or … the Query permission* | Grant the role, or the **Query** permission on that datasource. |
| An authentication or redirect error on a working Grafana | Add the headers of your proxy under **Custom headers**. |

***

> [!NOTE]
>
> Ewake only reads. It never writes metrics, logs or traces, and never modifies your datasources or your Grafana configuration.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.