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

Enable JS Sampling in Lighthouse Timespan mode in DevTools #15599

Closed
gilbertococchi opened this issue Nov 10, 2023 · 2 comments · Fixed by #15542
Closed

Enable JS Sampling in Lighthouse Timespan mode in DevTools #15599

gilbertococchi opened this issue Nov 10, 2023 · 2 comments · Fixed by #15542
Assignees

Comments

@gilbertococchi
Copy link

Hello everyone, in the context of Developers troubleshooting Interactions for INP I believe it would be useful to enable "JS Samples" by default in Lighthouse in DevTools.

By doing so Developers would find all the Samples useful to identify what Script (1P or 3P) is actually responsible for a reproduced high INP scenario.

@alexnj
Copy link
Member

alexnj commented Nov 10, 2023

Related:
#15542

@adamraine
Copy link
Member

This can't be done in DevTools (yet), but something like this could work for the Node API:

const flow = await startFlow(page);

// Enables JS samples for this flow step
await flow.startTimespan({additionalTraceCategories: 'disabled-by-default-v8.cpu_profiler'});
await page.click('button');
await flow.endTimespan();

const flowArtifacts = flow.createArtifactsJson();

// Get the trace for the first flow step
const trace = flowArtifacts.gatherSteps[0].artifacts.Trace;

fs.writeFileSync('trace.json', JSON.stringify(trace));

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

Successfully merging a pull request may close this issue.

4 participants