Skip to content

Make special handling of check metrics in StatsD output configurable #2470

Closed as not planned
@na--

Description

@na--

The statsd output (also used for NewRelic and DataDog, among others) currently has special handling of check metric samples:

case metrics.Rate:
if check, ok := entry.Tags.Get("check"); ok {
return o.client.Count(
checkToString(check, entry.Value),
1,
tagList,
1,
)
}

k6/output/statsd/output.go

Lines 94 to 100 in 59a8883

func checkToString(check string, value float64) string {
label := "pass"
if value == 0 {
label = "fail"
}
return "check." + check + "." + label
}

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 #1321 workaround). In any case, it definitely needs to be better documented (grafana/k6-docs#603) and maybe ideally also configurable (this issue) 🤔

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_TAGS to an empty string, the special handling of checks will be disabled
  • if the user sets K6_STATSD_EXPAND_RATE_ON_TAGS to something else, other Rate metrics could be expanded in a similar manner as well

Connected issues and forum threads:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementevaluation neededproposal needs to be validated or tested before fully implementing it in k6statsdSomething related to the statsd

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions