Trend.add metric not recorded if used too late

Hello and thanks for helping.

I have a time trend that I’m adding a custom time measurement to. It works unless I delay the test by 0.1 of a second. I can provide more complete code, but I think the relevant code is below.

I am running k6.exe v0.56.0 (commit/50afb99947, go1.23.4, windows/amd64)

This code works (delay of only 0.01 seconds in warmup):

import { check, sleep } from 'k6'
import { SharedArray } from 'k6/data'
import { vu } from 'k6/execution'
import { browser } from 'k6/browser'
import http from 'k6/http'
import { Trend } from 'k6/metrics'

const dashboardLoadTime = new Trend('dashboard_load_time', true);
// irrelevant (IMO) code not shown

export default async function main() {
  // page and user are created/retrieved
  try {
    await logOn(page, user);
    await warmup(page, user);
    await visitDashboardPage(page, user);
    await logOff(page, user);
  } finally {
    await page.close();
  }
}

async function warmup(page, user) {
  delaySeconds(0.01);
}
async function visitDashboardPage(page, user) {
  const startTime = new Date();
  // irrelevant (IMO) code not shown
  const endTime = new Date();
  const loadTime = endTime - startTime;
  dashboardLoadTime.add(loadTime);
}

function delaySeconds(duration) {
  sleep(duration);
}

Why would a longer delay in the warmup function cause the trend to either not be added, or not reported? This is repeatable (switching the delay back and forth from 0.1 to 0.01 either does not or does report the custom metric).