Skip to content

While using performance.measure(...) the detail fields isn't passed on to the PerformanceObserver since Node V20 #53570

Description

@mishaled

Version

20

Platform

Mac

Subsystem

perf_hooks

What steps will reproduce the bug?

const { performance, PerformanceObserver } = require('perf_hooks');

const perfObserver = new PerformanceObserver((items) => {
  const entries = items.getEntries();
  entries.forEach((entry) => console.log(entry));
});

perfObserver.observe({ entryTypes: ['measure'] });

performance.mark(`sample-start`);
console.log('doing some work...');
performance.mark('sample-end');

performance.measure('sample', {
  start: 'sample-start',
  end: 'sample-end',
  detail: { some: 'data' },
});

How often does it reproduce? Is there a required condition?

Reproduces consistently

What is the expected behavior? Why is that the expected behavior?

The expected output-

doing some work...
PerformanceMeasure {
  name: 'sample',
  entryType: 'measure',
  startTime: 8.93499899105882,
  duration: 6.525000999999975,
  detail: { some: 'data' }
}

What do you see instead?

doing some work...
PerformanceMeasure {
  name: 'sample',
  entryType: 'measure',
  startTime: 8.93499899105882,
  duration: 6.525000999999975,
}

Additional information

Works well when using Node V18

Activity

  1. avivkeller commented on Jun 24, 2024

    @avivkeller
    Member

    Thanks for the report! If you don't mind, could you edit your issue to use markdown code blocks? That way it'll be easier for viewers to see code vs text.

  2. added
    perf_hooksIssues and PRs related to the perf_hooks module and performance measurement APIs.
    on Jun 24, 2024
  3. MeCode50 commented on Jun 24, 2024

    @MeCode50

    @redyetidev I would like to work on this issue. I will start investigating the problem and will post updates here. Thank you!

  4. theanarkh commented on Jun 24, 2024

    @theanarkh
    Contributor

    You can use entry.detail or submit a PR to add toJSON function for PerformanceMeasure class .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    perf_hooksIssues and PRs related to the perf_hooks module and performance measurement APIs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions