Check function is not sending metrics

Hi guys, I’m trying to use the following check, but it doesn’t seem to be working very well.

    check(res, {
      "Too many request!": (r) => r.status === 429,
      "Not found!": (r) => r.status === 404,
      "Respondeu com sucesso!": (r) => [200, 301].includes(r.status),

I have an integration with New Relic, and there is not just a .pass metric appearing there, and in my test there are 3.


Thanks for the help.

Which k6 version are you using? If it’s not the last, can you try that and report if the problem persists?

Also, how are you sending the metrics to New Relic?


k6 v0.37.0 (2022-03-15T09:43:55+0000/67657f4, go1.17.7, linux/amd64)

I am sending metric following the documentation method.

Ah, I misunderstood your initial question. It seems like the StatsD k6 output (which is used for NewRelic) treats check metric samples slightly differently and actually transforms their names to check.<name>.pass or check.<name>.fail. I don’t remember why this was done, but it definitely needs to at least be documented, and maybe ideally also configurable :thinking:

FYI I created Make special handling of `check` metrics in StatsD output configurable · Issue #2470 · grafana/k6 · GitHub and Document special case for `check()` metrics in StatsD (NewRelic/DataDog) output · Issue #603 · grafana/k6-docs · GitHub so we can follow up on this in the future.