k6 icon indicating copy to clipboard operation
k6 copied to clipboard

Add support for additional labels when doing prometheus remote writes

Open amarao opened this issue 1 year ago • 2 comments

Feature Description

Currently, when k6 is doing remote writes into Prometheus, it does add a single label 'scenario'. When multiple k6 copies are run from multiple servers, they don't work together with a single Prometheus server.

It would be nice to be able to distinct different jobs in the Prometheus with different labels.

Suggested Solution (optional)

Add an environment variable (e.g. K6_PROMETHEUS_REMOTE_LABELS="environment=production,server=srv1") to specify list of labels to be set on the series send to the Prometheus.

Any other solution (e.g. configuration within js file) will solve the problem too.

amarao avatar Apr 25 '24 16:04 amarao

Hi @amarao,

Thanks for the feature request, we'll consider it within the team during one of our following issues review, as it goes through the pipeline.

joanlopez avatar May 13 '24 09:05 joanlopez

@amarao We ran into a similar problem in kubernetes. There is a way to add tags using command line flags so we inject the kubernetes pod ID as it's own tag. This eliminated the collision of data into one series.

For example:

k6 run .... --tag pod=${POD_NAME} ...

jameshounshell avatar May 30 '24 20:05 jameshounshell