From 428dfcf039c8334ce4ef0e1f85a507da251646ce Mon Sep 17 00:00:00 2001 From: Alina Varkki Date: Tue, 17 Dec 2024 12:33:53 +0000 Subject: [PATCH] [RPP] UMA histogram for the Timeline navigation setting Let's log the setting state every time that the first timeline is loaded in a new session. Logging on the first timeline load will make sure the navigation selection is only logged for people who use the performance panel. Logging on each first timeline load will allow us to get a number of people actually using either option instead of just the ones who try it out by toggling the setting. Bug: 313757601 Change-Id: If8a6a926e57c667f1e47eb3160cb17a3c547b2e6 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6099210 Auto-Submit: Alina Varkki Reviewed-by: Andres Olivares Commit-Queue: Alina Varkki --- front_end/core/host/InspectorFrontendHostAPI.ts | 1 + front_end/core/host/UserMetrics.ts | 15 +++++++++++++++ front_end/devtools_compatibility.js | 1 + front_end/panels/timeline/TimelinePanel.ts | 16 ++++++++++++++++ 4 files changed, 33 insertions(+) diff --git a/front_end/core/host/InspectorFrontendHostAPI.ts b/front_end/core/host/InspectorFrontendHostAPI.ts index 4b18222a45..d4982c596d 100644 --- a/front_end/core/host/InspectorFrontendHostAPI.ts +++ b/front_end/core/host/InspectorFrontendHostAPI.ts @@ -478,6 +478,7 @@ export const enum EnumeratedHistogram { SourcesPanelFileDebugged = 'DevTools.SourcesPanelFileDebugged', SourcesPanelFileOpened = 'DevTools.SourcesPanelFileOpened', NetworkPanelResponsePreviewOpened = 'DevTools.NetworkPanelResponsePreviewOpened', + TimelineNavigationSettingState = 'DevTools.TimelineNavigationSettingState', StyleTextCopied = 'DevTools.StyleTextCopied', CSSHintShown = 'DevTools.CSSHintShown', LighthouseModeRun = 'DevTools.LighthouseModeRun', diff --git a/front_end/core/host/UserMetrics.ts b/front_end/core/host/UserMetrics.ts index 0cdd7f383a..709fe66c95 100644 --- a/front_end/core/host/UserMetrics.ts +++ b/front_end/core/host/UserMetrics.ts @@ -182,6 +182,11 @@ export class UserMetrics { EnumeratedHistogram.ExperimentEnabledAtLaunch, experiment, DevtoolsExperiments.MAX_VALUE); } + navigationSettingAtFirstTimelineLoad(state: TimelineNavigationSetting): void { + InspectorFrontendHostInstance.recordEnumeratedHistogram( + EnumeratedHistogram.TimelineNavigationSettingState, state, TimelineNavigationSetting.MAX_VALUE); + } + experimentDisabledAtLaunch(experimentId: string): void { const experiment = DevtoolsExperiments[experimentId as keyof typeof DevtoolsExperiments]; if (experiment === undefined) { @@ -1431,3 +1436,13 @@ export const enum AnimationPointDragType { OTHER = 4, MAX_VALUE = 5, } + +export const enum TimelineNavigationSetting { + // Setting is set to classic when the first trace of the session is recorded or loaded. + CLASSIC_AT_SESSION_FIRST_TRACE = 0, + // Setting is set to modern when the first trace of the session is recorded or loaded. + MODERN_AT_SESSION_FIRST_TRACE = 1, + SWITCHED_TO_CLASSIC = 2, + SWITCHED_TO_MODERN = 3, + MAX_VALUE = 4, +} diff --git a/front_end/devtools_compatibility.js b/front_end/devtools_compatibility.js index 1a65fb1bb4..32f1832597 100644 --- a/front_end/devtools_compatibility.js +++ b/front_end/devtools_compatibility.js @@ -438,6 +438,7 @@ const EnumeratedHistogram = { SourcesPanelFileDebugged: 'DevTools.SourcesPanelFileDebugged', SourcesPanelFileOpened: 'DevTools.SourcesPanelFileOpened', NetworkPanelResponsePreviewOpened: 'DevTools.NetworkPanelResponsePreviewOpened', + TimelineNavigationSettingState: 'DevTools.TimelineNavigationSettingState', StyleTextCopied: 'DevTools.StyleTextCopied', SyncSetting: 'DevTools.SyncSetting', CSSPropertyDocumentation: 'DevTools.CSSPropertyDocumentation', diff --git a/front_end/panels/timeline/TimelinePanel.ts b/front_end/panels/timeline/TimelinePanel.ts index 948c1abcf2..8e6de76e13 100644 --- a/front_end/panels/timeline/TimelinePanel.ts +++ b/front_end/panels/timeline/TimelinePanel.ts @@ -1167,8 +1167,12 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod const currentNavSetting = Common.Settings.moduleSetting('flamechart-selected-navigation').get(); if (currentNavSetting === 'classic') { this.#classicNavRadioButton.radioElement.checked = true; + Host.userMetrics.navigationSettingAtFirstTimelineLoad( + Host.UserMetrics.TimelineNavigationSetting.SWITCHED_TO_CLASSIC); } else if (currentNavSetting === 'modern') { this.#modernNavRadioButton.radioElement.checked = true; + Host.userMetrics.navigationSettingAtFirstTimelineLoad( + Host.UserMetrics.TimelineNavigationSetting.SWITCHED_TO_MODERN); } } @@ -2048,6 +2052,18 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod } this.#showSidebarIfRequired(); + + // When the timeline is loaded for the first time, log what navigation setting is selected. + // This will allow us to get an estimate number of people using each option. + if (this.#traceEngineModel.size() === 1) { + if (Common.Settings.moduleSetting('flamechart-selected-navigation').get() === 'classic') { + Host.userMetrics.navigationSettingAtFirstTimelineLoad( + Host.UserMetrics.TimelineNavigationSetting.CLASSIC_AT_SESSION_FIRST_TRACE); + } else { + Host.userMetrics.navigationSettingAtFirstTimelineLoad( + Host.UserMetrics.TimelineNavigationSetting.MODERN_AT_SESSION_FIRST_TRACE); + } + } } /**