Http_req_failed reporting passes as failures

Hi,

As per the below, the http_req_failed metric is reporting 71 fails. However, all 71submissions were in fact 200 responses.

STDOUT

JSON
image

Additionally, Fiddler is reporting the responses as 200’s.

Is this a known bug and if so, is there a way around it.

Thanks in advance,
Paul.

Hi @PaulCluver

Welcome to the community forum :wave:

This might seem a bit counterintuitive, at least it is for me. My mind associates with pass and “good”, and with fail and “not good”.

However, the http_req_failed is a rate that keeps track of the failures. And in the above output, the passes is the number of times it finds a failure.

If you run a test that returns a 200:

import http from 'k6/http';
import { sleep } from 'k6';

export default function () {
    http.get('https://httpbin.test.k6.io/status/200');
    sleep(1);
}

You get 0% failures in the rate, and 0 “passes”, 1 “fails”:

http_req_failed................: 0.00%  ✓ 0        ✗ 1  

And if you run a test that returns a 500:

import http from 'k6/http';
import { sleep } from 'k6';

export default function () {
    http.get('https://httpbin.test.k6.io/status/500');
    sleep(1);
}

You get 100% failure rate, and 1 “passes”, 0 “fails”:

http_req_failed............: 100.00% ✓ 1        ✗ 0  

The JSON reflects the same structure, and as such, you would have to look at the rate value of http_req_failed, which in your case is already 0% (71 requests, all with 200 status code). And if you are looking at the concrete number of requests that did not return 200, those are in the passes value.

This metric was discussed further in Proposal for adding a new standard `http_req_failures` metric · Issue #1828 · grafana/k6 · GitHub, and I’ve opened a doc issue to review if we can better document this: Review if we can document http_req_failed pass/fail values · Issue #1185 · grafana/k6-docs · GitHub.

I hope this helps.

Cheers!

This is very helpful. Thank you so much for your prompt support.

1 Like