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

core(responsiveness): use raw trace event #13970

Merged
merged 1 commit into from
May 6, 2022
Merged

Conversation

brendankenny
Copy link
Member

@brendankenny brendankenny commented May 5, 2022

part of #13916

Rather than the responsiveness computed artifact returning just the duration, it now returns the whole trace event, which will allow the attribution audit to use all the other properties on that same event.

Functionality is unchanged.

@brendankenny brendankenny requested a review from a team as a code owner May 5, 2022 23:12
@brendankenny brendankenny requested review from connorjclark and removed request for a team May 5, 2022 23:12
* Base event of a `ph: 'X'` 'complete' event. Extend with `name` and `args` as
* needed.
*/
interface CompleteEvent {
Copy link
Member Author

@brendankenny brendankenny May 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of harkens back to your trace types, @connorjclark :)

I kind of like this pattern of building up the event type compared to the Omit<>+build pattern used here:

/** @typedef {Omit<LH.TraceEvent, 'name'|'args'> & {name: 'FrameCommittedInBrowser', args: {data: {frame: string, url: string, parent?: string}}}} FrameCommittedEvent */
/** @typedef {Omit<LH.TraceEvent, 'name'|'args'> & {name: 'largestContentfulPaint::Invalidate'|'largestContentfulPaint::Candidate', args: {data?: {size?: number}, frame: string}}} LCPEvent */
/** @typedef {Omit<LH.TraceEvent, 'name'|'args'> & {name: 'largestContentfulPaint::Candidate', args: {data: {size: number}, frame: string}}} LCPCandidateEvent */

(where you still have some random optional properties from the LH.TraceEvent frankenstein)

@@ -11,50 +11,51 @@
* user input in the provided trace).
*/

/** @typedef {LH.Trace.CompleteEvent & {name: 'Responsiveness.Renderer.UserInteraction', args: {frame: string, data: {interactionType: 'drag'|'keyboard'|'tapOrClick', maxDuration: number}}}} ResponsivenessEvent */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: did you consider defining this in .d.ts (for ergonomic reasons)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: did you consider defining this in .d.ts (for ergonomic reasons)?

maybe if it spreads, but so far it's really just needed in this one file and the two files that call it are fine with the implicit type from the function return.

There's also the multi-line jsdoc format, it's just unfortunate that vscode doesn't do better syntax highlighting for it (probably should file that as an issue at some point).

@brendankenny brendankenny mentioned this pull request May 6, 2022
30 tasks
@devtools-bot devtools-bot merged commit a0939be into master May 6, 2022
@devtools-bot devtools-bot deleted the responsiveness-event branch May 6, 2022 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants