Is there a way to view duration for each group without having to define thresholds?

Hello,

I had a really hard time finding how I could display in the summary the group_duration for each group.
By default the group_duration metric is aggregating the duration of all the groups (which I find quite counter intuitive).
The only way I’ve found to be able to see the group_duration for each individual group is to define thresholds.

For example if I have a group named ‘get-profiles’ and a group named ‘get-profiles2’, without defining thresholds here is the output :

group_duration.................: avg=112.17ms min=59.03ms med=120.24ms max=157.25ms p(90)=149.85ms p(95)=153.55ms

Now to be able to see the group_duration for each group I had to set these thresholds :

export const options = {
    thresholds: {
        'group_duration{group:::get-profiles}': ['max < 1000'],
        'group_duration{group:::get-profiles2}': ['max < 1000'],
    }
};

Which gives me the desired output :

     group_duration.................: avg=112.17ms min=59.03ms  med=120.24ms max=157.25ms p(90)=149.85ms p(95)=153.55ms
     ✓ { group:::get-profiles2 }....: avg=59.03ms  min=59.03ms  med=59.03ms  max=59.03ms  p(90)=59.03ms  p(95)=59.03ms
     ✓ { group:::get-profiles }.....: avg=120.24ms min=120.24ms med=120.24ms max=120.24ms p(90)=120.24ms p(95)=120.24ms

Is there any better way to output the group_duration for each group ?
I find it weird that I have to create thresholds (which I don’t care about here) just to be able to see them.

Same question of http_req_duration. How can I display the duration for each tag without having to create thresholds ?

Ex:

export const options = {
    thresholds: {
        'http_req_duration{id:user-token}': ['max < 1000'],
        'http_req_duration{id:profiles}': ['max < 1000'],
    }
};

is the only way I’ve found to have this ouptut :

     http_req_duration..............: avg=79.1ms   min=44.22ms  med=73.34ms  max=119.75ms p(90)=110.47ms p(95)=115.11ms
       { expected_response:true }...: avg=79.1ms   min=44.22ms  med=73.34ms  max=119.75ms p(90)=110.47ms p(95)=115.11ms
     ✓ { id:profiles }..............: avg=58.78ms  min=44.22ms  med=58.78ms  max=73.34ms  p(90)=70.43ms  p(95)=71.89ms
     ✓ { id:user-token }............: avg=119.75ms min=119.75ms med=119.75ms max=119.75ms p(90)=119.75ms p(95)=119.75ms

Unfortunately, the only way to currently surface sub-metrics in the end-of-test summary is to define thresholds on them. And even that workaround is somewhat poorly documented right now… :disappointed:

We want to change that and we are currently in the midst of a heavy refactoring of the k6 metrics internals, so that goal is getting more and more achievable, but we’re not there yet, sorry.

For now, thresholds on tags, your own custom metrics or sending the raw metrics data to an external output are the only ways to achieve what you want.

2 Likes