sincecutoff.com
← all changes

k6 Prometheus remote write adds static labels

Introduced 2026-09-21 · score 0.98

HOW TO USE IT

When multiple k6 processes send metrics to the same Prometheus endpoint, set `K6_PROMETHEUS_RW_LABELS` to comma-separated `key=value` labels and run with `--out experimental-prometheus-rw` so each process's time series can be distinguished.

K6_PROMETHEUS_RW_LABELS="environment=production,server=srv1" k6 run --out experimental-prometheus-rw <script.js>

WHY THIS HELPS

When running tests from multiple k6 instances that send metrics to the same Prometheus server, label each instance's time series.

REQUIREMENTS AND LIMITATIONS

  • Version: v2.3.0
  • K6_PROMETHEUS_RW_LABELS: Comma-separated `key=value` pairs of static labels for remote-write time series; defaults to no additional labels.
  • --out experimental-prometheus-rw (required): Selects the Prometheus remote write output for the k6 run.
  • <script.js> (required): Path to the k6 test script; the docs use `script.js` as the example.
  • Prerequisite: Set up a running Prometheus remote-write endpoint and ensure k6 can reach it. For Prometheus 2.x, enable `--web.enable-remote-write-receiver`.
  • Prerequisite: The Prometheus remote-write output is experimental.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card