Skip to content

Display the event type from DOM events in chrome profiles#4604

Merged
julienw merged 3 commits into
firefox-devtools:mainfrom
julienw:import-event-name
May 3, 2023
Merged

Display the event type from DOM events in chrome profiles#4604
julienw merged 3 commits into
firefox-devtools:mainfrom
julienw:import-event-name

Conversation

@julienw

@julienw julienw commented May 2, 2023

Copy link
Copy Markdown
Contributor

With this change, it's now possible to see the dom event types in the marker chart and table. They also show up in the timeline.
Moreover now it should be easier to display data for other events.

The more difficult thing left is to map the stack trace that's part of some of these events to the stack table, so that we could display the cause in the tooltip... A task for a follow-up.

Here is a profile imported from this deploy preview: https://share.firefox.dev/3npso3p (notice that the dom event names show up in the marker chart and table)
And here is the same profile displayed with this deploy preview (notice they also show up in the timeline now)

Design notes: I used this type2 property so that we still have type to pick the schema. Ideally we'd make the name pick up the schema too but I was afraid of regressions with gecko profiles, so I'd like to have some more available time to work on the profiler codebase to be able to do that. Tell me what you think!

@julienw julienw force-pushed the import-event-name branch from bbf5292 to 5ea7d10 Compare May 2, 2023 14:34
@julienw julienw requested a review from canova May 2, 2023 14:35

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Looks good to me. I think we can give a better name to type2 but let me know what you think!

display: ['marker-chart', 'marker-table', 'timeline-overview'],
data: [
{
key: 'type2',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how about making this eventType instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought about that, but this would be right only for DispatchEvent markers. What if other markers also have type in their payload, but that's not related to events?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, this schema's name is EventDispatch though. Do we expect other markers to have the same name as well?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, I see what you mean now. We need to change the code below that's generic. Hm, I guess it's okay to keep it this way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can add a comment to be more explicit about this though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, a comment could be nice. It wasn't clear to me at first. Thanks!

argData.type2 = argData.type;
}
if (argData && 'category' in argData) {
argData.category2 = argData.category;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess we don't use the category2? Do we still need it? I may be missing something though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was thinking that I don't want to lose any data.

You could argue that we can lose type2 and category2 😅

Maybe we can use something less typical such as __type or $type or __original__type?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see. I don't have a lot of good alternatives tbh. I think it's fine to keep type2 and catergory2 too then.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks!
It's super easy to change later if we need it too, as it's used only here with this indirection.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've been thinking that our internal "type" should probably have been more collision-proof. But I guess this is a bit late for that now.

@julienw julienw force-pushed the import-event-name branch from 5ea7d10 to 17e37e3 Compare May 3, 2023 12:06
@julienw julienw enabled auto-merge May 3, 2023 12:06
@julienw julienw force-pushed the import-event-name branch from 17e37e3 to efb3348 Compare May 3, 2023 12:07
@julienw julienw merged commit a08de4e into firefox-devtools:main May 3, 2023
@canova canova mentioned this pull request May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants