How to add Spitfire as a Grafana data source
Grafana's own Prometheus, Loki and Tempo data sources read Spitfire directly: APM, host and data source metrics, load-test runs, logs and traces. No plugin is needed; Grafana never reaches Spitfire's database, and every request goes through Spitfire's token and workspace rules.
What you need
| What | For |
|---|---|
| Grafana 10.4 or newer | The built-in Prometheus, Loki and Tempo data sources |
| Access from Grafana to Spitfire's address | The data sources connect to Spitfire from the server (proxy) |
| An account in Spitfire | To create the read-only token |
1. Get the addresses and the token
- In Spitfire, open the Integrations
In Spitfire: /admin/integrations#grafanapage. - Scroll to the Read Spitfire from Grafana card.
- Press Create a read-only token.
- Copy the HTTP header for the data sources line on the card with Copy. The token is shown only once.
The token reads only /prom, /loki and /tempo in this workspace (datasource:read) and expires after a year. You can also create it on API tokens In Spitfire: /api-tokens with Scope → Grafana data sources only (read).
Success check: try the token before you go to Grafana (replace the address and the token with yours); the answer starts with {"status":"success","data":[...]}:
curl -s -H "Authorization: Bearer sfpat_..." https://spitfire.example.com/prom/api/v1/labels2. Add the metrics data source (Prometheus)
- In Grafana, go to Connections → Data sources → Add data source.
- Choose Prometheus.
- Type
Spitfire metricsin Name. - Type Spitfire's address followed by
/promin Prometheus server URL, for examplehttps://spitfire.example.com/prom. - Under HTTP headers, press Add header.
- Type
Authorizationin Header andBearerfollowed by the token in Value. - Type
1min Interval behaviour → Scrape interval. - Press Save & test. You should see "Successfully queried the Prometheus API".
1m matters: APM points are per minute; with a shorter interval rate() comes back empty.
3. Add the logs data source (Loki)
- Add data source → choose Loki.
- Type
Spitfire logsin Name. - Type
https://spitfire.example.com/lokiin URL. - Add the same
Authorizationheader as in step 2 under HTTP headers. - Press Save & test.
4. Add the traces data source (Tempo)
- Add data source → choose Tempo.
- Type
Spitfire tracesin Name. - Type
https://spitfire.example.com/tempoin URL. - Add the same
Authorizationheader under HTTP headers. - Under Streaming, turn off Search queries and Metrics queries.
- Optionally, under Trace to logs, choose
Spitfire logsas Data source; you can then jump from a trace to its logs. - Press Save & test.
With streaming left on, Grafana tries to search over gRPC and TraceQL searches fail. Spitfire answers searches over HTTP only.
5. Import the ready dashboards
- On Spitfire's Read Spitfire from Grafana card, download Services, Hosts and Load-test runs.
- In Grafana, go to Dashboards → New → Import.
- Drop the downloaded file on Upload dashboard JSON file.
- Press Import.
- In the Spitfire metrics, Spitfire logs and Spitfire traces pickers at the top of the dashboard, choose the data sources you added.
The data sources are dashboard variables; the same files work with data sources of other names.
If you set up Grafana with files (provisioning)
Instead of steps 2–4, save this file as /etc/grafana/provisioning/datasources/spitfire.yaml, change the address and the token, and restart Grafana:
apiVersion: 1
datasources:
- name: Spitfire metrics
uid: spitfire-prom
type: prometheus
access: proxy
url: https://spitfire.example.com/prom
jsonData: { httpHeaderName1: Authorization, timeInterval: 1m }
secureJsonData: { httpHeaderValue1: "Bearer sfpat_..." }
- name: Spitfire logs
uid: spitfire-loki
type: loki
access: proxy
url: https://spitfire.example.com/loki
jsonData: { httpHeaderName1: Authorization }
secureJsonData: { httpHeaderValue1: "Bearer sfpat_..." }
- name: Spitfire traces
uid: spitfire-tempo
type: tempo
access: proxy
url: https://spitfire.example.com/tempo
jsonData:
httpHeaderName1: Authorization
streamingEnabled: { search: false, metrics: false }
tracesToLogsV2: { datasourceUid: spitfire-loki, filterByTraceID: true }
secureJsonData: { httpHeaderValue1: "Bearer sfpat_..." }Query examples
sum by (service) (rate(spitfire_apm_requests_total[5m]))
max by (service) (spitfire_apm_latency_ms{quantile="0.95"})
100 * (1 - avg by (host) (spitfire_host_system_cpu_utilization{state="idle"}))
{service="checkout-api", level="error"} |= "timeout"
{ resource.service.name = "checkout-api" && status = error && duration > 500ms }Grafana's Explore → Metrics browser lists every metric name.
Details
| Topic | What it does, its limits |
|---|---|
| Metric names | spitfire_apm_* (requests, errors, duration, latency with a quantile label), spitfire_app_* (the applications' OpenTelemetry metrics), spitfire_host_* (Agent), spitfire_datasource_*, spitfire_run_* (runs, per second) |
| Labels | APM: service, env, version, endpoint, http_status; the host label comes only when the query has a host matcher |
| Workspace | APM, logs, traces and runs are the token's workspace's; host and data source metrics are the whole installation's |
| PromQL | Selectors, rate/increase/*_over_time, aggregation operators and Prometheus' functions including histogram_quantile; the APM minimum step is 1 minute |
| LogQL | Stream selector, line filters (|=, !=, |~, !~), json/logfmt and label filters, drop, count_over_time/rate/bytes_* with sum/avg/min/max/count. Not available: line_format, label_format, unwrap, pattern, regexp, operations between two queries, topk, offset, live tail |
| TraceQL | One spanset: name, status, kind, duration, resource.*, span.*, .*, &&, ||, parentheses, =, !=, =~, !~, numeric comparisons. Not available: pipelines (| count() etc.), structural operators (>>, ~), trace:/event:/link: fields, TraceQL metrics |
| Trace by ID | JSON and protobuf; Grafana's v1 and v2 requests |
| Authentication | Authorization: Bearer <token>; with basic auth, an empty user name and the token as the password |
| Limits | Query time, series and rows are limited; a query over them is refused with a plain message, narrow the range |
| Dashboard files | Spitfire's /grafana/spitfire-services.json, /grafana/spitfire-hosts.json, /grafana/spitfire-runs.json |