SpitfireLoad Testing & APMWhat's new

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

  1. In Spitfire, open the Integrations In Spitfire: /admin/integrations#grafana page.
  2. Scroll to the Read Spitfire from Grafana card.
  3. Press Create a read-only token.
  4. 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":[...]}:

bash
curl -s -H "Authorization: Bearer sfpat_..." https://spitfire.example.com/prom/api/v1/labels

2. Add the metrics data source (Prometheus)

  1. In Grafana, go to Connections → Data sources → Add data source.
  2. Choose Prometheus.
  3. Type Spitfire metrics in Name.
  4. Type Spitfire's address followed by /prom in Prometheus server URL, for example https://spitfire.example.com/prom.
  5. Under HTTP headers, press Add header.
  6. Type Authorization in Header and Bearer followed by the token in Value.
  7. Type 1m in Interval behaviour → Scrape interval.
  8. 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)

  1. Add data source → choose Loki.
  2. Type Spitfire logs in Name.
  3. Type https://spitfire.example.com/loki in URL.
  4. Add the same Authorization header as in step 2 under HTTP headers.
  5. Press Save & test.

4. Add the traces data source (Tempo)

  1. Add data source → choose Tempo.
  2. Type Spitfire traces in Name.
  3. Type https://spitfire.example.com/tempo in URL.
  4. Add the same Authorization header under HTTP headers.
  5. Under Streaming, turn off Search queries and Metrics queries.
  6. Optionally, under Trace to logs, choose Spitfire logs as Data source; you can then jump from a trace to its logs.
  7. Press Save & test.
Warning

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

  1. On Spitfire's Read Spitfire from Grafana card, download Services, Hosts and Load-test runs.
  2. In Grafana, go to Dashboards → New → Import.
  3. Drop the downloaded file on Upload dashboard JSON file.
  4. Press Import.
  5. 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:

yaml
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

text
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