K6 operator prometheus build-in parameter

Hello. I’ve just setup the k6-operator and I just noticed that there is a parameter to send metrics to prometheus. Here are the docs and the corresponding value parameter here.

So far I was using the prometheus remote write to send testss results but what is this about? I couldn’t find any other mention to this and on what metrics does it send. Also, I enabled it and I didn’t receive any k6_* metrics to the Prometheus through its ServiceMonitor.

Any ideas on what metrics does this provide?

The prometheus.enabled parameter in k6-operator doesn’t push metrics to Prometheus. Instead, it creates a metrics endpoint that Prometheus can scrape.

When you enable this parameter, the k6-operator sets up:

  • A metrics service exposing k6 performance data
  • A ServiceMonitor custom resource (if you have Prometheus Operator installed)

For this to work properly:

  1. Make sure your Prometheus instance is configured to discover ServiceMonitors
  2. Check that the ServiceMonitor labels match your Prometheus instance’s serviceMonitorSelector
  3. Verify the metrics endpoint is actually receiving data (you can port-forward to the service and curl the /metrics endpoint)

The metrics should include standard k6 performance data (request rates, response times, errors) with the k6_ prefix.

1 Like