Hi everybody, I am facing an issue when trying to retrieve metrics for the browser module from Prometheus. I have enabled histograms, but I am still unable to obtain my prefixed metrics such as _p95, p99. Here are my metrics from Prometheus:
I have not found information in the official documentation on how to make it work. Are
acceptable for K6 browser module metrics when using Prometheus remote write?
Can I have more information on how you set this up? Docker compose files, the command line you use to run the tests, anything to try and replicate your environment.
I’m not up to speed on the prometheus-remote-write output, so bear with me. I did the following and I was able to view the
_p99 (which by default you should get) and when working with K6_PROMETHEUS_RW_TREND_STATS I was able to retrieve all the metrics that I had listed in the env var.
- Copy this docker-compose file.
- Run it with
docker compose up -d prometheus grafana.
- Download the latest release of k6.
- Run the example fillform.js with the following command:
./k6 run -o experimental-prometheus-rw fillform.js.
- Navigate to http://localhost:9090/ and search for metrics prefxied with
Running it with
K6_PROMETHEUS_RW_TREND_STATS like so
K6_PROMETHEUS_RW_TREND_STATS=p(95),p(99),min,max ./k6 run -o experimental-prometheus-rw fillform.js resulted in the expected metrics that I had configured:
EDIT: It might be useful to work with prometheus’s native histogram instead. How to do that is outlined in step 2 of Send test metrics to a remote write endpoint.