The Prometheus remote write integration allows to export metrics from k6 Cloud to a Prometheus instance: either self-hosted or provided by a vendor.
With the Prometheus integration, you can:
- Store k6 metrics on your Prometheus instances.
- Run PromQL queries on k6 metrics.
- Correlate testing results with other system metrics collected with Prometheus.
We currently offer similar integrations with Cloud APM solutions: Azure Monitor, DataDog, Grafana Cloud, and New Relic. If you use any of these solutions, we recommend starting to integrate your APM solution first.
⭐️ Prometheus remote write and Cloud APM integrations are available on Pro and Enterprise plans, as well as the annual Team plan and Trial.
Currently, you can only enable this integration using the apm option in the k6 script.
The apm option configures how to export k6 Cloud metrics to the supported monitoring solutions. It allows multiple configuration blocks to export simultaneously to different monitoring providers.
The parameters for sending metrics to a Prometheus Remote Write instance are as follows:
|provider(required)||For this integration, the value must be prometheus.|
|remoteWriteURL(required)||URL of the Prometheus remote write endpoint. |
For example: http://monitoring.example.com:9090/api/v1/write.
|credentials||The credentials to authenticate with the Prometheus remote write instance. |
Read more on supported authentication mechanisms.
|includeDefaultMetrics||Whether it exports the default APM metrics: data_sent, data_received, http_req_duration, http_reqs, iterations, and vus. Default is true.|
|metrics||List of built-in and custom metrics to export. |
Metric names are validated against the Prometheus metric name conventions—ignoring nonconforming metrics.
|includeTestRunId||Whether all the exported metrics include a test_run_id tag whose value is the k6 Cloud test run id. Default is false. |
Be aware that enabling this setting might increase the cost of your APM provider.
|resampleRate||The rate by which the metrics are resampled and sent to the APM provider in seconds. Default is 3 and acceptable values are integers between 1 and 10.|
Currently, the integration only supports bearer token and HTTP basic authentication mechanisms. Set the credentials option to configure one of the supported authentication mechanisms as follows:
HTTP basic authentication
Bearer token authentication
When running the cloud test, k6 Cloud will export the metrics to the Prometheus endpoint almost real-time.