grafana / xk6-output-prometheus-remote

k6 extension to output real-time test metrics using Prometheus Remote Write.
GNU Affero General Public License v3.0
156 stars 72 forks source link

k6_http_req_failed is always 1 #77

Closed Limess closed 1 year ago

Limess commented 1 year ago

The metric k6_http_req_failed is always 1, rather than a counter, so we can't see a count via increase or rate.

There's a good chance I've misunderstood this metric - is it supposed to be a gauge indicating a scenario failure? Should we add our own error rate metric?

image

Build command:

go install go.k6.io/xk6/cmd/xk6@latest
xk6 build \
    --with github.com/grafana/xk6-output-prometheus-remote@latest

Version:

xk6-output-prometheus-remote 0.06

go: downloading go.k6.io/k6 v0.41.1-0.20221116104224-5fa71b761185
codebien commented 1 year ago

Hi @Limess, yes, a k6's rate like k6_http_req_failed is mapped to a gauge and, in this case, it is always expected to be one because you have expected_response, error_code and status tags that generate individual time series. You should aggregate them to get a unique representation.

For example, for average, you could use:

sum(sum_over_time(k6_http_req_failed_rate[1m])) by (name)
/
sum(count_over_time(k6_http_req_failed_rate[1m])) by (name)

Instead, if you don't care about these tags, you could disable them using the k6 option systemTags.

v0.0.7 is out, it has important updates. Please, upgrade.

Limess commented 1 year ago

Thanks, will close this.