k6
k6 copied to clipboard
Make special handling of `check` metrics in StatsD output configurable
The statsd output (also used for NewRelic and DataDog, among others) currently has special handling of check metric samples:
https://github.com/grafana/k6/blob/59a8883676edf4e28edb39561c33ebd941e05944/output/statsd/output.go#L79-L87 https://github.com/grafana/k6/blob/59a8883676edf4e28edb39561c33ebd941e05944/output/statsd/output.go#L94-L100
It transforms the metric names to check.<check-name>.pass or check.<check-name>.fail. I don't remember why this was done, probably because StatsD doesn't seem to support anything like our Rate metric (so we transform it to 2 Count ones here) and because we didn't want the checks to be grouped together (sort of a localized https://github.com/grafana/k6/issues/1321 workaround). In any case, it definitely needs to be better documented (https://github.com/grafana/k6-docs/issues/603) and maybe ideally also configurable (this issue) :thinking:
For example, we can add a new K6_STATSD_EXPAND_RATE_ON_TAGS option to the statsd output, with the default value of check. Then:
- the current behavior of the output will be preserved with the default value
- if the user sets
K6_STATSD_EXPAND_RATE_ON_TAGSto an empty string, the special handling of checks will be disabled - if the user sets
K6_STATSD_EXPAND_RATE_ON_TAGSto something else, otherRatemetrics could be expanded in a similar manner as well
Connected issues and forum threads:
- https://community.k6.io/t/check-function-is-not-sending-metrics/3334
- https://github.com/grafana/k6/issues/1403