w3c/long-animation-frames

[LoAF] Settle on what `PerformanceScriptTiming.name` means

Closed this issue · 10 comments

It feels a bit weird that name is actually a string that can mean several things, and in fact represents the invoker.
Proposal:

  • name should return what type returns now (name would return event-listener, script-block etc)
  • invoker would return what name returns now (e.g. img#id.onload, TimerHandler:setTimeout)
  • Remove type

Open to other proposals and feedback.

Gathering RUM data with PageVitals, I'm trying to get familiar with the different results being sent from the LoAF API.

I think type is a great name for event-listener, classic-script, user-callback, promise-resolve, ... so I'd rather keep that.

Renaming name to invoker could be a good idea because if gives the developer a better notion of what this really means.

In the case of type "classic-script" it's a bit redundant to have the script URL both in the name (or invoker) and the sourceLocation. It looks like they are the same in this case - but where sourceLocation may also have the invoked entry function as well as the column number.

Gathering RUM data with PageVitals, I'm trying to get familiar with the different results being sent from the LoAF API.

I think type is a great name for event-listener, classic-script, user-callback, promise-resolve, ... so I'd rather keep that.

Renaming name to invoker could be a good idea because if gives the developer a better notion of what this really means.

In the case of type "classic-script" it's a bit redundant to have the script URL both in the name (or invoker) and the sourceLocation. It looks like they are the same in this case - but where sourceLocation may also have the invoked entry function as well as the column number.

The reason to have anything at all in name is because in the future we might want to make these nested performance entries available via performance.getEntriesByName(), though this is likely a YAGNI.

With @noamr proposal, we would no longer be able to use performance.getEntriesByName() to collect all LoAF. What could we use instead, performance.getEntries().filter(x => x.constructor.name == 'PerformanceLongAnimationFrameTiming')? (whether or not it's relevant is another question, I'm just trying to wrap my mind around it).

I feel like whether we keep name for event-listener, classic-script, user-callback, promise-resolve goes further that LoAF. PerformanceResourceTimings have names with URLs. PerformancePaintTimings have names that are more alike to what @lasseschou calls invoker, I feel it's already quite inconsistent. But using performance.getEntriesByName() to retrieve a specific kind of LoAF makes sense so why not.

With @noamr proposal, we would no longer be able to use performance.getEntriesByName() to collect all LoAF.

To clarify, this is only about the LoAF's scripts, which ATM are not retrieved with getEntriesByName.

Oh sorry, I'll think about it again, then.

In PerformanceNavigationTiming, type is a string representing the navigation type. event-listener, classic-script, etc. are not Script types, so for the sake of spec coherence, I feel like type is not necessarily adapted.

In PerformanceServerTiming, name is a string representing the name of the timing. I feel that event-listener, classic-script, etc. are not names either, rather qualifiers.

Couldn't they be entryType instead? script is quite redundant there…

In PerformanceNavigationTiming, type is a string representing the navigation type. event-listener, classic-script, etc. are not Script types, so for the sake of spec coherence, I feel like type is not necessarily adapted.

In PerformanceServerTiming, name is a string representing the name of the timing. I feel that event-listener, classic-script, etc. are not names either, rather qualifiers.

Couldn't they be entryType instead? script is quite redundant there…

That's an option. They're not exactly the type of script, I thought to rename that invokerType.
In most cases the entryType matches the IDL type (e.g. resource matches to PerformanceResourceTiming)

Am with @lasseschou, type feels more descriptive than name for event-listener, script-block etc..
invoker is very clear, like that, though DevTools > Network panel uses initiator, which is also quite descriptive?

I think perhaps invokerType rather than type though, e.g. the entryType is still script (maps with the IDL PerformanceScriptTiming)

So, invoker + invokerType or initiator + initiatorType, then? I must say I like initiator.