k6 icon indicating copy to clipboard operation
k6 copied to clipboard

Emit the value of the threshold-metric at the end of the test.

Open sniku opened this issue 3 years ago • 4 comments

At the end of the k6 run -o cloud test, k6 should send both the result of the threshold and the value of the metric the threshold is using.

Environment

  • k6 version: 0.31.1
  • k6 run -o cloud test.

Actual Behavior

At the end of the test, k6 sends the result of the threshold (true or false) but does not send the value of the metric itself. k6 currently sends a structure similar to this

{
  "result_status": 0,
  "run_status": 3,
  "thresholds": {
    "check_failure_rate": {
      "rate<0.01": false,
      "rate<=0.05": false
    },
    "http_req_duration{staticAsset:yes}": {
      "p(99)<250": false
    }
  }
}

Expected Behavior

k6 should send both the result of the threshold and the value of the metric the threshold is using. The above structure should look similar to this

{
   "result_status":0,
   "run_status":3,
   "thresholds":{
      "check_failure_rate":{
         "rate<0.01":{
            "result":false,
            "value":0.01
         },
         "rate<=0.05":{
            "result":false,
            "value":0.01
         }
      },
      "http_req_duration{staticAsset:yes}":{
         "p(99)<250":{
            "result":false,
            "value":219.54
         }
      }
   }
}

Steps to Reproduce the Problem

  1. Run a k6 run -o cloud script.js test
  2. View the Thresholds tab. The value is missing. image

Dependencies

This issue is most likely blocked by #1443 and #961 because k6 currently doesn't know the threshold metric value since the threshold is evaluated in its own js runtime. #1832 would help but is not a hard blocker (?).

sniku avatar Apr 08 '21 13:04 sniku