This is a attempt to provide data from the k6 load testing tool to Prometheus in order to display and visualize it in Grafana
It is written in Go and acts as proxy for the k6 REST API, exposing the results over HTTP in the standard Prometheus exposition format, at the standard /metrics
endpoint
Goals:
- See if it was possible using the k6 REST API
- Report on k6 load tests without needing to push huge volumes of data into a CSV or InfluxDB
See example-job.yaml for an example of how to deploy k6-prometheus-exporter as a sidecar alongside a k6 load test, running as a Kubernetes job.
You can also run it as a standalone pod external from k6, this requires that the k6 REST API (port 6565 by default) is exposed as a service. See deploy/standalone for an example of doing this
- If you wish to build or run locally, use
make build
ormake run
- If you wish to build the Docker image, use
make image
ormake push
. When calling make set IMAGE_REG, IMAGE_REPO and IMAGE_TAG as you wish
docker run ghcr.io/benc-uk/k6-prometheus-exporter:latest
Example of some of the data shown in a Grafana dashboard
Setting / Variable | Purpose | Default |
---|---|---|
METRICS_PORT | Port the server will listen on. | 2112 |
K6_API_ENDPOINT | Override the endpoint used to connect to k6 | http://localhost:6565/v1 |
A brief description of the top-level directories of this project is as follows:
/api - Details of the API specification & docs
/build - Build configuration e.g. Dockerfiles
/charts - Helm charts
/deploy - Deployment and infrastructure as code, inc Kubernetes
/scripts - Bash and other supporting scripts
/src - Source code
/test - Testing, mock data and API + load tests
List any known bugs or gotchas.
This project uses the MIT software license. See full license file
Optional. Put acknowledgements and credits here, if any