Using Grafana Cloud Prometheus and the k6 extension for Prometheus remote write, you can send your k6 metrics into Grafana Cloud to better visualize your testing results, enabling you to correlate k6 metrics with other metrics of your observability stack.
While this article focuses on Grafana Cloud, any remote-write capable Prometheus installation is compatible with this approach.
⚠️ For k6 Cloud tests, follow the k6 Cloud instructions.
If you do not have a Grafana Cloud account, you can sign up here. The free plan includes 10,000 Prometheus series.
Now, you need the URL, username and password of your Grafana Cloud Prometheus instance to configure the integration.
Log in to Grafana.com and visit the Cloud Portal. Click on the Details button of your Prometheus service.
Copy the URL of the Remote Write Endpoint and the Username / Instance ID.
On the Password / API Key section, create and copy an API key of MetricsPublisher role that will be used as password.
To output k6 metrics to Prometheus, you have to run a k6 version built with the extension for Prometheus remote write.
xk6 will create the k6 binary in the local folder.
To learn more about how to build custom k6 versions, check out xk6
Now, pass the Username, API key, and Remote Write Endpoint of the Grafana Cloud Prometheus Configuration to the k6 binary built with the extension as follows:
In Grafana Cloud, click on the Explore icon on the menu bar, and choose the Prometheus data source from the dropdown in the top left. In the query field, query k6 metrics to explore your testing results.