Skip to content

Commit 428dfcf

Browse files
AlinaVarkkiDevtools-frontend LUCI CQ
authored andcommitted
[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 <[email protected]> Reviewed-by: Andres Olivares <[email protected]> Commit-Queue: Alina Varkki <[email protected]>
1 parent 9e6f101 commit 428dfcf

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

front_end/core/host/InspectorFrontendHostAPI.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ export const enum EnumeratedHistogram {
478478
SourcesPanelFileDebugged = 'DevTools.SourcesPanelFileDebugged',
479479
SourcesPanelFileOpened = 'DevTools.SourcesPanelFileOpened',
480480
NetworkPanelResponsePreviewOpened = 'DevTools.NetworkPanelResponsePreviewOpened',
481+
TimelineNavigationSettingState = 'DevTools.TimelineNavigationSettingState',
481482
StyleTextCopied = 'DevTools.StyleTextCopied',
482483
CSSHintShown = 'DevTools.CSSHintShown',
483484
LighthouseModeRun = 'DevTools.LighthouseModeRun',

front_end/core/host/UserMetrics.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ export class UserMetrics {
182182
EnumeratedHistogram.ExperimentEnabledAtLaunch, experiment, DevtoolsExperiments.MAX_VALUE);
183183
}
184184

185+
navigationSettingAtFirstTimelineLoad(state: TimelineNavigationSetting): void {
186+
InspectorFrontendHostInstance.recordEnumeratedHistogram(
187+
EnumeratedHistogram.TimelineNavigationSettingState, state, TimelineNavigationSetting.MAX_VALUE);
188+
}
189+
185190
experimentDisabledAtLaunch(experimentId: string): void {
186191
const experiment = DevtoolsExperiments[experimentId as keyof typeof DevtoolsExperiments];
187192
if (experiment === undefined) {
@@ -1431,3 +1436,13 @@ export const enum AnimationPointDragType {
14311436
OTHER = 4,
14321437
MAX_VALUE = 5,
14331438
}
1439+
1440+
export const enum TimelineNavigationSetting {
1441+
// Setting is set to classic when the first trace of the session is recorded or loaded.
1442+
CLASSIC_AT_SESSION_FIRST_TRACE = 0,
1443+
// Setting is set to modern when the first trace of the session is recorded or loaded.
1444+
MODERN_AT_SESSION_FIRST_TRACE = 1,
1445+
SWITCHED_TO_CLASSIC = 2,
1446+
SWITCHED_TO_MODERN = 3,
1447+
MAX_VALUE = 4,
1448+
}

front_end/devtools_compatibility.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ const EnumeratedHistogram = {
438438
SourcesPanelFileDebugged: 'DevTools.SourcesPanelFileDebugged',
439439
SourcesPanelFileOpened: 'DevTools.SourcesPanelFileOpened',
440440
NetworkPanelResponsePreviewOpened: 'DevTools.NetworkPanelResponsePreviewOpened',
441+
TimelineNavigationSettingState: 'DevTools.TimelineNavigationSettingState',
441442
StyleTextCopied: 'DevTools.StyleTextCopied',
442443
SyncSetting: 'DevTools.SyncSetting',
443444
CSSPropertyDocumentation: 'DevTools.CSSPropertyDocumentation',

front_end/panels/timeline/TimelinePanel.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,8 +1167,12 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
11671167
const currentNavSetting = Common.Settings.moduleSetting('flamechart-selected-navigation').get();
11681168
if (currentNavSetting === 'classic') {
11691169
this.#classicNavRadioButton.radioElement.checked = true;
1170+
Host.userMetrics.navigationSettingAtFirstTimelineLoad(
1171+
Host.UserMetrics.TimelineNavigationSetting.SWITCHED_TO_CLASSIC);
11701172
} else if (currentNavSetting === 'modern') {
11711173
this.#modernNavRadioButton.radioElement.checked = true;
1174+
Host.userMetrics.navigationSettingAtFirstTimelineLoad(
1175+
Host.UserMetrics.TimelineNavigationSetting.SWITCHED_TO_MODERN);
11721176
}
11731177
}
11741178

@@ -2048,6 +2052,18 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
20482052
}
20492053

20502054
this.#showSidebarIfRequired();
2055+
2056+
// When the timeline is loaded for the first time, log what navigation setting is selected.
2057+
// This will allow us to get an estimate number of people using each option.
2058+
if (this.#traceEngineModel.size() === 1) {
2059+
if (Common.Settings.moduleSetting('flamechart-selected-navigation').get() === 'classic') {
2060+
Host.userMetrics.navigationSettingAtFirstTimelineLoad(
2061+
Host.UserMetrics.TimelineNavigationSetting.CLASSIC_AT_SESSION_FIRST_TRACE);
2062+
} else {
2063+
Host.userMetrics.navigationSettingAtFirstTimelineLoad(
2064+
Host.UserMetrics.TimelineNavigationSetting.MODERN_AT_SESSION_FIRST_TRACE);
2065+
}
2066+
}
20512067
}
20522068

20532069
/**

0 commit comments

Comments
 (0)