Skip to main content

Connect Grafana Datasources

Connect Grafana to xScaler metrics, logs, and traces as native Prometheus, Loki, and Tempo datasources. Once connected you can query, correlate, and alert across all signals from a single Grafana instance.

Works with Grafana 9.1+. Both self-hosted and Grafana Cloud.


Before you start

You need the following from the xScaler portal for each tenant you want to query:

ItemWhere to find it
API tokenOrganization → Tenants → tenant name → API keys
Tenant IDShown in the tenant list and on the tenant detail page
Region endpointsSee Regions & Endpoints

For the euw1-01 region:

SignalQuery endpoint
Metricshttps://euw1-01.m.xscalerlabs.com
Logshttps://euw1-01.l.xscalerlabs.com
Traceshttps://euw1-01.t.xscalerlabs.com

:::tip One token, three datasources A single API token works for all three signals as long as it is scoped for read access. Create it once and reuse it across all datasource configs. :::


Metrics: Prometheus datasource

Step 1: Add a new connection

In Grafana, go to Connections → Add new connection. Search for Prometheus and click the Prometheus card.

Add new connection in Grafana, search for Prometheus

Step 2: Set the server URL

In the Prometheus server URL field enter the metrics endpoint for your region:

https://euw1-01.m.xscalerlabs.com

Prometheus server URL field in Grafana

:::tip No path suffix Enter the host root only. Grafana appends /api/v1/query automatically. Do not add any path. :::

Step 3: Add HTTP headers

Scroll down to the HTTP Headers section and add two headers:

HeaderValue
AuthorizationBearer <your-api-token>
X-Scope-OrgID<your-tenant-id>

HTTP Headers section with Authorization and X-Scope-OrgID

:::danger Use HTTP Headers only Do not use the Basic Auth fields or the Grafana Authentication section. xScaler accepts Bearer tokens in custom HTTP headers only. :::

Step 4: Save & test

Click Save & test. A successful response shows:

Successfully queried the Prometheus API.

Prometheus Save &amp; Test success in Grafana


Logs: Loki datasource

Step 1: Add a new connection

In Grafana, go to Connections → Add new connection. Search for Loki and click the Loki card.

Loki datasource settings in Grafana

Step 2: Set the URL

In the URL field enter the logs endpoint:

https://euw1-01.l.xscalerlabs.com

Loki URL field in Grafana

Step 3: Add HTTP headers

Scroll to HTTP Headers and add:

HeaderValue
AuthorizationBearer <your-api-token>
X-Scope-OrgID<your-tenant-id>

Loki HTTP Headers in Grafana

Step 4: Save & test

Click Save & test. A successful response shows:

Data source successfully connected.

Loki Save &amp; Test success in Grafana

:::note No data yet? If the connection succeeds but queries come back empty, no logs have arrived for this tenant yet. Send logs first using Grafana Alloy or the OTel Collector. :::


Traces: Tempo datasource

Step 1: Add a new connection

In Grafana, go to Connections → Add new connection. Search for Tempo and click the Tempo card.

Tempo datasource settings in Grafana

Step 2: Set the URL

In the URL field enter the traces endpoint:

https://euw1-01.t.xscalerlabs.com

Tempo URL field in Grafana

Step 3: Add HTTP headers

Scroll to HTTP Headers and add:

HeaderValue
AuthorizationBearer <your-api-token>
X-Scope-OrgID<your-tenant-id>

Tempo HTTP Headers in Grafana

Step 4: Save & test

Click Save & test. A successful response shows:

Data source is working

Tempo Save &amp; Test success in Grafana


With all three datasources connected, configure Grafana to jump between signals automatically.

Trace to logs

In the Tempo datasource settings scroll to Trace to logs:

FieldValue
Data sourceYour Loki datasource
Tagsservice.name
Filter by trace IDEnabled

This adds a Logs button on every span view that jumps to the correlated log lines for the same service and time window.

Trace to metrics

In the Tempo datasource settings scroll to Trace to metrics:

FieldValue
Data sourceYour Prometheus datasource
Queryrate(traces_spanmetrics_duration_bucket{service="${__span.tags.service.name}"}[$__rate_interval])

Metrics to logs (Correlations)

  1. Go to Administration → Correlations.
  2. Click Add correlation.
  3. Set Source to your Prometheus datasource.
  4. Set Target to your Loki datasource.
  5. Use {job="${job}"} as the target query and map the job label from the metric series.

Verify all three in Explore

Open Explore to confirm each signal works end-to-end.

Metrics. Select the Prometheus datasource and run:

up

Logs. Select the Loki datasource and run:

{job=~".+"}

Live log lines from Loki in Grafana Explore

Traces. Select the Tempo datasource, switch to the Search tab, and click Run query with no filters.

Trace waterfall view in Grafana Explore


Troubleshooting

"Bad Gateway" on Save & Test

  • Verify the URL is the host root only (e.g. https://euw1-01.m.xscalerlabs.com) with no path suffix and no trailing slash.
  • Confirm HTTPS. HTTP is not accepted.

"Forbidden" (403) on Save & Test

  • The token may be write-only. Generate a read or read+write token: go to Organization → Tenants → tenant name → API keys in the portal and create a new key.

401 Unauthorized

  • The Authorization header value must be exactly Bearer <token>: capital B, one space, then the raw token.
  • Check that the header is in the HTTP Headers section, not in the Grafana Authentication panel.

"No org id" error in queries

  • The X-Scope-OrgID header is missing. Add it to the HTTP Headers section of the datasource config.

Loki: "Data source connected" but no labels

  • No logs have been ingested yet for this tenant.
  • The label browser only shows labels active in the selected time range. Widen the time picker.

Tempo: No traces found

  • Use the Search tab with a wide time range and no service filter to confirm traces exist.
  • Check the time range. It must cover the period when traces were sent.