Bug 223256

Summary: Web Inspector: add GridOverlay diagnostic event and related hooks
Product: WebKit Reporter: Razvan Caliman <rcaliman>
Component: Web InspectorAssignee: Razvan Caliman <rcaliman>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, ews-watchlist, hi, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch bburg: review+, ews-feeder: commit-queue-

Description Razvan Caliman 2021-03-16 08:39:15 PDT
Add telemetry for usage of CSS Grid Inspector
Comment 1 Radar WebKit Bug Importer 2021-03-16 08:39:43 PDT
<rdar://problem/75478239>
Comment 2 Razvan Caliman 2021-03-16 08:55:39 PDT
Created attachment 423335 [details]
Patch

patch for requesting feedback
Comment 3 BJ Burg 2021-03-16 09:54:56 PDT
Comment on attachment 423335 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=423335&action=review

> Source/WebInspectorUI/UserInterface/Base/Main.js:587
> +        WI.diagnosticController.addRecorder(new WI.GridOverlayDiagnosticEventRecorder(WI.diagnosticController));

Nit: add backend feature check (InspectorBackend.supports("DOM.showGridOverlay") or similar)

> Source/WebInspectorUI/UserInterface/Controllers/GridOverlayDiagnosticEventRecorder.js:65
> +                options[value] = value;

As discussed, we should always include all the keys we know about and use 0 or 1 for booleans.

What do you think about collecting whether the grid overlay was drawn with a non-default color? (Probably need to query the overlay manager to determine this in a sane way)

> Source/WebInspectorUI/UserInterface/Controllers/GridOverlayDiagnosticEventRecorder.js:74
> +WI.GridOverlayDiagnosticEventRecorder.TriggerType = {

Let's call this 'Initiator' which is a more common terminology in our codebase for hints like this.
Comment 4 Devin Rousso 2021-03-16 10:14:13 PDT
Comment on attachment 423335 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=423335&action=review

>> Source/WebInspectorUI/UserInterface/Base/Main.js:587
>> +        WI.diagnosticController.addRecorder(new WI.GridOverlayDiagnosticEventRecorder(WI.diagnosticController));
> 
> Nit: add backend feature check (InspectorBackend.supports("DOM.showGridOverlay") or similar)

NIT: I'd also put this last (grid overlay is likely not as important/used as target types or tab stuff)

> Source/WebInspectorUI/UserInterface/Controllers/GridOverlayDiagnosticEventRecorder.js:53
> +        // While changing the overlay color, WI.OverlayManager.Event.GridOverlayShown is dispatched with high frequency.
> +        // A trigger is not provided so as not to skew usage count of overlay options.

I feel like this would be better at the call site, not here.

> Source/WebInspectorUI/UserInterface/Controllers/GridOverlayDiagnosticEventRecorder.js:57
> +        let usedOptions = [

IMO this is kinda odd.  Is there a way to do this more declaratively without `reduce`?

> Source/WebInspectorUI/UserInterface/Controllers/GridOverlayDiagnosticEventRecorder.js:62
> +            "showAreaNames"

Style: missing comma
Comment 5 Razvan Caliman 2021-03-16 10:58:55 PDT
Created attachment 423356 [details]
Patch
Comment 6 Razvan Caliman 2021-03-16 11:09:42 PDT
Comment on attachment 423335 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=423335&action=review

>>> Source/WebInspectorUI/UserInterface/Base/Main.js:587
>>> +        WI.diagnosticController.addRecorder(new WI.GridOverlayDiagnosticEventRecorder(WI.diagnosticController));
>> 
>> Nit: add backend feature check (InspectorBackend.supports("DOM.showGridOverlay") or similar)
> 
> NIT: I'd also put this last (grid overlay is likely not as important/used as target types or tab stuff)

@BJ, I think you meant `InspectorBackend.hasCommand("DOM.showGridOverlay")`
@Devin, ok.

>> Source/WebInspectorUI/UserInterface/Controllers/GridOverlayDiagnosticEventRecorder.js:53
>> +        // A trigger is not provided so as not to skew usage count of overlay options.
> 
> I feel like this would be better at the call site, not here.

Good idea. Moved.

>> Source/WebInspectorUI/UserInterface/Controllers/GridOverlayDiagnosticEventRecorder.js:57
>> +        let usedOptions = [
> 
> IMO this is kinda odd.  Is there a way to do this more declaratively without `reduce`?

Declarative done.

>> Source/WebInspectorUI/UserInterface/Controllers/GridOverlayDiagnosticEventRecorder.js:65
>> +                options[value] = value;
> 
> As discussed, we should always include all the keys we know about and use 0 or 1 for booleans.
> 
> What do you think about collecting whether the grid overlay was drawn with a non-default color? (Probably need to query the overlay manager to determine this in a sane way)

Made them integers with the expectation that these will be summed-up over time. That's what we're interested in anyway: which options are most used.
We may switch to booleans if we expect to use them as such and if the views allow us to filter the data as we need it.

>> Source/WebInspectorUI/UserInterface/Controllers/GridOverlayDiagnosticEventRecorder.js:74
>> +WI.GridOverlayDiagnosticEventRecorder.TriggerType = {
> 
> Let's call this 'Initiator' which is a more common terminology in our codebase for hints like this.

Done!
Comment 7 BJ Burg 2021-03-16 11:14:15 PDT
Comment on attachment 423356 [details]
Patch

r=me
Comment 8 BJ Burg 2021-03-17 14:39:26 PDT
Committed r274592 (235433@main): <https://commits.webkit.org/235433@main>