k6 icon indicating copy to clipboard operation
k6 copied to clipboard

[Console output] http_req_failed : "succMark" & "failMark" seems inversed?

Open placaze opened this issue 3 years ago • 11 comments

Brief summary

     data_received..................: 7.2 MB 240 kB/s
     data_sent......................: 498 kB 17 kB/s
[...]
     http_req_failed................: 56.68% ✓ 403      ✗ 308
[...]
     http_reqs......................: 711    23.61168/s

I think ✓ and ✗ are inversed here. There should be more failed than succeed.

k6 version

0.35.0

OS

Windows 10

Docker version and image (if applicable)

No response

Steps to reproduce the problem

Do a simple run of k6. Nothing fancy.

Expected behaviour

http_req_failed................: 56.68% ✓ 308      ✗ 403

Actual behaviour

http_req_failed................: 56.68% ✓ 403      ✗ 308

placaze avatar Dec 19 '21 21:12 placaze

Thanks for reporting this! Technically, since the http_req_failed metric is tracking the failures, it's technically correct. But yeah, that's super confusing :disappointed:

So, I'm not sure if we should just reverse the marks, but maybe we should hide them or turn them into text labels? :thinking:

http_req_failed................: 56.68% failed: 403      successful: 308

Also, I am not sure if this should be a hack, a check just for the http_req_failed metric in here: https://github.com/grafana/k6/blob/804203bcf574da57cd05d67b39f03d05c54523ab/js/summary.js#L233-L238 Or should it be a more universal solution? Maybe Rate metrics should have an additional parameter that allows users to specify that they are inverted? Similarly to how Trend metrics have a parameter that specifies if they are tracking time or not?

For now, as a workaround, you can define your own handleSummary() function to do whatever you want with it, but yeah, we need to fix this in k6.

na-- avatar Dec 20 '21 09:12 na--

I got confused by this, too, while discovering k6.

turn them into text labels

To me, text labels would remove any ambiguity 👍

NevilleC avatar Dec 27 '21 16:12 NevilleC

Hi, so just to clarify, is the %age shown the % of requests that failed? So 0% http_req_failed means 100% requests succeeded (either by the default comparison to 200 status code or overridden by the user)?

So a checkmark in the output defines the amount of failed requests, and the x defines the amount of successful requests?

f0ff886f avatar Mar 28 '22 10:03 f0ff886f

Yes :disappointed:

na-- avatar Mar 29 '22 06:03 na--

+1, that is overly confusing

Totalus avatar Apr 25 '22 19:04 Totalus

how is it going to affect thresholds? Should the http_req_failed: ['rate '] be reversed as well?

mariaduran-ecr avatar Jun 17 '22 19:06 mariaduran-ecr

@mariaduran-ecr, it shouldn't. The problem is that the end-of-test summary assumes that all Rate metrics are about measuring "positive" events, i.e. that a rate of 100% is a good thing. That assumption doesn't hold for http_req_failed, where we want the rate of failed requests to be 0%. And it probably also doesn't hold for some custom Rate metrics that users might have defined in their scripts.

And IIRC, http_req_failed is negative precisely because it's easier to reason about it that way when it comes to thresholds. For example, the constraint of "I want under 1% of requests to fail" can be directly expressed as the http_req_failed: ['rate < 0.01'] threshold definition.

na-- avatar Jun 20 '22 10:06 na--

I'm trying out k6 now and this definitely confused the heck out of me.

nthornton2010 avatar May 12 '23 18:05 nthornton2010

Another proposal that I came up with in #3656 was to actually use words to say how many of the given rate were "truthy"

image

This way it seems like there is no ambiguity.

mstoykov avatar Apr 10 '24 13:04 mstoykov