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: Trend

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

const myTrend = new Trend('http_req_duration_create_booking', true);
2 Likes

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.