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); + } + } } /**