You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a custom metric is defined, but no data for that metric is recorded, it's not displayed in the results, and thresholds are not properly evaluated.
It's easiest to show it on an example.
Consider this script.
import{Counter}from'k6/metrics';import{sleep}from'k6';importhttpfrom'k6/http';letallErrors=newCounter('error_counter');exportletoptions={thresholds: {error_counter: ['count < 10',// 10 of fewer errors are tolerated]}}exportdefaultfunction(){letauth_resp=http.post('https://test-api.k6.io/auth/token/login/',{username: 'test-user','password': 'supersecure'});if(auth_resp.status>=400){allErrors.add(1,{errorType: 'authError'});// tagged value creates submetric (useful for making thresholds specific)}sleep(1);}
If the test run is successful, the allErrors will contain 0 errors. In that case metric as well as the threshold indicator won't be present in the output.
I expected both to be present, just like in this case, when 1 error was recorded:
The most problematic manifestation of this bug is when threshold should fail, but doesn't because it's not evaluated.
Example:
import{Counter}from'k6/metrics';import{sleep}from'k6';importhttpfrom'k6/http';letallErrors=newCounter('error_counter');exportletoptions={thresholds: {error_counter: ['count < 10'// This threshold should fail, but it doesn't]}}exportdefaultfunction(){sleep(1);}
The text was updated successfully, but these errors were encountered:
When a custom metric is defined, but no data for that metric is recorded, it's not displayed in the results, and thresholds are not properly evaluated.
It's easiest to show it on an example.
Consider this script.
If the test run is successful, the
allErrors
will contain 0 errors. In that case metric as well as the threshold indicator won't be present in the output.I expected both to be present, just like in this case, when 1 error was recorded:
The most problematic manifestation of this bug is when threshold should fail, but doesn't because it's not evaluated.
Example:
The text was updated successfully, but these errors were encountered: