Skip to main content

Grafana Overview

Learning Objectives

  • Explain Grafana's role as a pure visualisation layer in xScaler
  • Describe how Grafana datasources connect to xScaler backends
  • Understand the difference between platform-metrics and xMetrics datasources
  • Read the pre-provisioned datasource YAML from the repository

Grafana in the xScaler Architecture

Grafana is a visualisation and alerting layer — it does not store data. It queries the xScaler backends via datasource plugins and renders dashboards.

Grafana's role:

  • Dashboard creation and display
  • Alert rule evaluation and routing
  • Cross-signal correlation (trace → log → metric)
  • User access control (RBAC)

Grafana does NOT do:

  • Store any metrics, logs, or traces
  • Ingest or collect telemetry
  • Manage tenants or API keys (use portal-api for this)

Datasource Model

Each xScaler signal requires its own Grafana datasource:

SignalDatasource TypeURLAuth Headers
MetricsPrometheushttps://euw1-01.m.xscalerlabs.com/prometheusAuthorization: Bearer xag_... + X-Scope-OrgID
LogsxLogshttps://euw1-01.l.xscalerlabs.comAuthorization: Bearer xag_... + X-Scope-OrgID
TracesxTraceshttps://euw1-01.t.xscalerlabs.comAuthorization: Bearer xag_... + X-Scope-OrgID

System vs Client Datasources

The local dev Grafana has four pre-provisioned datasources:

# deploy/observability/grafana/provisioning/datasources/datasource.yml
datasources:
- name: platform-metrics
type: prometheus
url: http://platform-metrics:9010/prometheus
jsonData:
httpHeaderName1: X-Scope-OrgID
secureJsonData:
httpHeaderValue1: system-monitoring
# Used by: xScaler platform operators
# Shows: xMetrics internals, Envoy stats, proxy-auth metrics

- name: xMetrics
type: prometheus
url: http://xMetrics:9009/prometheus
jsonData:
httpHeaderName1: X-Scope-OrgID
secureJsonData:
httpHeaderValue1: <your-tenant-id>
# Used by: tenant users
# Shows: their own application metrics

- name: xLogs
type: loki
url: http://xLogs:3100
jsonData:
httpHeaderName1: X-Scope-OrgID
secureJsonData:
httpHeaderValue1: <your-tenant-id>

- name: tempo
type: tempo
url: http://tempo:3200
jsonData:
httpHeaderName1: X-Scope-OrgID
secureJsonData:
httpHeaderValue1: <your-tenant-id>
No API Key in Local Dev

In the local dev stack, Envoy is not in the path for Grafana queries — Grafana connects directly to xMetrics/xLogs/xTraces. In production, Grafana queries go through Envoy and require Authorization: Bearer xag_....


Cross-Signal Correlation

One of Grafana's most powerful features is correlating the three signals:

Trace-to-Logs Configuration

# xTraces datasource
jsonData:
tracesToLogs:
datasourceUid: xscaler-logs
filterByTraceID: true
filterBySpanID: false
tags: ["service.name", "deployment.environment"]

Trace-to-Metrics Configuration

# xTraces datasource
jsonData:
tracesToMetrics:
datasourceUid: xscaler-metrics
tags: [{key: "service.name", value: "service"}]
queries:
- name: Error rate
query: sum(rate(http_errors_total{$__tags}[5m]))

Hands-On Exercise

Exercise 5.1 — Explore Pre-Provisioned Datasources

  1. Open Grafana at https://<slug>.g.xscalerlabs.com
  2. Navigate to Connections → Data Sources

[Screenshot: Grafana datasources list showing platform-metrics, xMetrics, xLogs, and tempo with green status indicators]

  1. Click on xMetricsSave & Test

Expected result: "Data source connected and labels found."

  1. Click on tempoSave & Test

Expected result: "Data source successfully connected."

Exercise 5.2 — Run Cross-Signal Query

  1. Open Explore
  2. Select xTraces datasource
  3. Search for recent traces: click Search tab → Run Query
  4. Click on a trace to open the trace view
  5. Click Logs for this span to see related logs

[Screenshot: xTraces trace view with spans expanded, showing "Logs for this span" button]


Validation

  • All four datasources show green status
  • PromQL up returns results in xMetrics
  • LogQL {service=~".+"} returns log streams in xLogs
  • xTraces search returns at least one trace
  • Clicking a trace span shows the "Logs" button

Key Takeaways

Session 5.1 Summary
  • Grafana is a pure visualisation layer — no data storage, no ingestion
  • Each signal (metrics, logs, traces) requires its own datasource configuration
  • platform-metrics = platform observability (for xScaler operators)
  • xMetrics/loki/tempo = tenant data (for tenant users)
  • Cross-signal correlation links traces → logs → metrics via trace_id and service.name

← Previous: Session 5 Overview
Next: Deployment Options →