Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mishaled opened this issue Jun 24, 2024 · 3 comments
Labels
perf_hooks Issues and PRs related to the implementation of the Performance Timing API.

Comments

@mishaled
Copy link

mishaled commented Jun 24, 2024

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

@avivkeller
Copy link
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.

@avivkeller avivkeller added the perf_hooks Issues and PRs related to the implementation of the Performance Timing API. label Jun 24, 2024
@MeCode50
Copy link

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

@theanarkh
Copy link
Contributor

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

nodejs-github-bot pushed a commit that referenced this issue Jun 29, 2024
PR-URL: #53603
Refs: #53570
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
aduh95 pushed a commit that referenced this issue Jul 12, 2024
PR-URL: #53603
Refs: #53570
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
aduh95 pushed a commit that referenced this issue Jul 16, 2024
PR-URL: #53603
Refs: #53570
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
marco-ippolito pushed a commit that referenced this issue Aug 19, 2024
PR-URL: #53603
Refs: #53570
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
marco-ippolito pushed a commit that referenced this issue Aug 19, 2024
PR-URL: #53603
Refs: #53570
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf_hooks Issues and PRs related to the implementation of the Performance Timing API.
Projects
None yet
Development

No branches or pull requests

4 participants