k6 extension for publishing test-run metrics to Prometheus via Remote Write endpoint.
🔖 As of k6 v0.42.0, this extension is available within k6 as an experimental module. This means that the extension has entered the process of being fully merged into the core of k6 and does not require a special build with xk6 to utilize this feature.
See the Prometheus remote write guide to utilize this feature.
There are many options for remote-write compatible agents, the official list can be found here. The exact details of how metrics will be processed or stored depends on the underlying agent used.
⚠️ Not to be confused with Prometheus Remote Write client extension which is for load testing Prometheus itself.
To build k6 binary with the Prometheus remote write output extension use:
xk6 build --with github.com/grafana/xk6-output-prometheus-remote@latest
Then run new k6 binary with the following command for using the default configuration (e.g. remote write server url set to http://localhost:9090/api/v1/write
):
./k6 run -o xk6-prometheus-rw script.js
Check the documentation for advanced configurations, Docker Compose ready to use example or for using the builtin experimental output.
Pre-built Grafana dashboards are available. Check the dashboard guide how to import and use it from the source code or directly from Grafana.com.
Note: The dashboards work with the Native Histogram mapping so it is required to enable it.