Custom Metrics - New Trend does not display unit time(ms/s)

Hi,

I’m having an issue with New Trend in that its not displaying the unit time in the console output.

This is how am I setting it. Not sure what I’m doing wrong.

const myTrend = new Trend('http_req_duration_create_booking');

myTrend.add(resCreateBookings.timings.duration, {
        bookingTag: 'create booking',
      });

the Trend constructor has an optional second argument that tells k6 it’s dealing with time, see the docs: https://k6.io/docs/javascript-api/k6-metrics/trend

So, in your case, you have to do this:

const myTrend = new Trend('http_req_duration_create_booking', true);
1 Like

Thanks @ned for the fast reply…I’m not sure how I missed that in the documentation. Unit time is displayed if I add true. Thanks again and sorry for not properly reading the documentation.