Skip to content

Commit a8444a0

Browse files
authored
telemetry - document keys (microsoft#155563)
1 parent e670090 commit a8444a0

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

src/vs/base/common/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export interface ITelemetryData {
1515

1616
export type WorkbenchActionExecutedClassification = {
1717
owner: 'bpasero';
18-
id: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
19-
from: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
18+
id: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier of the action that was run.' };
19+
from: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The name of the component the action was run from.' };
2020
};
2121

2222
export type WorkbenchActionExecutedEvent = {

src/vs/workbench/contrib/telemetry/browser/telemetry.contribution.ts

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ type TelemetryData = {
3636
};
3737

3838
type FileTelemetryDataFragment = {
39-
mimeType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
40-
ext: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
41-
path: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
42-
reason?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
43-
allowlistedjson?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
39+
mimeType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The language type of the file (for example XML).' };
40+
ext: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The file extension of the file (for example xml).' };
41+
path: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The path of the file as a hash.' };
42+
reason?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'The reason why a file is read or written. Allows to e.g. distinguish auto save from normal save.' };
43+
allowlistedjson?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The name of the file but only if it matches some well known file names such as package.json or tsconfig.json.' };
4444
};
4545

4646
export class TelemetryContribution extends Disposable implements IWorkbenchContribution {
@@ -67,27 +67,29 @@ export class TelemetryContribution extends Disposable implements IWorkbenchContr
6767
const activeViewlet = paneCompositeService.getActivePaneComposite(ViewContainerLocation.Sidebar);
6868

6969
type WindowSizeFragment = {
70-
innerHeight: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
71-
innerWidth: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
72-
outerHeight: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
73-
outerWidth: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
70+
innerHeight: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'The height of the current window.' };
71+
innerWidth: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'The width of the current window.' };
72+
outerHeight: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'The height of the current window with all decoration removed.' };
73+
outerWidth: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'The width of the current window with all decoration removed.' };
74+
comment: 'The size of the window.';
7475
};
7576

7677
type WorkspaceLoadClassification = {
7778
owner: 'bpasero';
78-
userAgent: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
79-
emptyWorkbench: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
79+
userAgent: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The user agent as reported by `navigator.userAgent` by Electron or the web browser.' };
80+
emptyWorkbench: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Whether a folder or workspace is opened or not.' };
8081
windowSize: WindowSizeFragment;
81-
'workbench.filesToOpenOrCreate': { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
82-
'workbench.filesToDiff': { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
83-
'workbench.filesToMerge': { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
82+
'workbench.filesToOpenOrCreate': { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of files that should open or be created.' };
83+
'workbench.filesToDiff': { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of files that should be compared.' };
84+
'workbench.filesToMerge': { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'Number of files that should be merged.' };
8485
customKeybindingsCount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
85-
theme: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
86-
language: { classification: 'SystemMetaData'; purpose: 'BusinessInsight' };
87-
pinnedViewlets: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
88-
restoredViewlet?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
89-
restoredEditors: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
90-
startupKind: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true };
86+
theme: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The current theme of the window.' };
87+
language: { classification: 'SystemMetaData'; purpose: 'BusinessInsight'; comment: 'The display language of the window.' };
88+
pinnedViewlets: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifiers of views that are pinned.' };
89+
restoredViewlet?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier of the view that is restored.' };
90+
restoredEditors: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'The number of editors that restored.' };
91+
startupKind: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'How the window was opened, e.g via reload or not.' };
92+
comment: 'Metadata around the workspace that is being loaded into a window.';
9193
};
9294

9395
type WorkspaceLoadEvent = {
@@ -141,13 +143,15 @@ export class TelemetryContribution extends Disposable implements IWorkbenchContr
141143
if (settingsType) {
142144
type SettingsReadClassification = {
143145
owner: 'bpasero';
144-
settingsType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
146+
settingsType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The type of the settings file that was read.' };
147+
comment: 'Track when a settings file was read, for example from an editor.';
145148
};
146149

147150
this.telemetryService.publicLog2<{ settingsType: string }, SettingsReadClassification>('settingsRead', { settingsType }); // Do not log read to user settings.json and .vscode folder as a fileGet event as it ruins our JSON usage data
148151
} else {
149152
type FileGetClassification = {
150153
owner: 'bpasero';
154+
comment: 'Track when a file was read, for example from an editor.';
151155
} & FileTelemetryDataFragment;
152156

153157
this.telemetryService.publicLog2<TelemetryData, FileGetClassification>('fileGet', this.getTelemetryData(e.model.resource, e.reason));
@@ -159,12 +163,14 @@ export class TelemetryContribution extends Disposable implements IWorkbenchContr
159163
if (settingsType) {
160164
type SettingsWrittenClassification = {
161165
owner: 'bpasero';
162-
settingsType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
166+
settingsType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The type of the settings file that was written to.' };
167+
comment: 'Track when a settings file was written to, for example from an editor.';
163168
};
164169
this.telemetryService.publicLog2<{ settingsType: string }, SettingsWrittenClassification>('settingsWritten', { settingsType }); // Do not log write to user settings.json and .vscode folder as a filePUT event as it ruins our JSON usage data
165170
} else {
166171
type FilePutClassfication = {
167172
owner: 'bpasero';
173+
comment: 'Track when a file was written to, for example from an editor.';
168174
} & FileTelemetryDataFragment;
169175
this.telemetryService.publicLog2<TelemetryData, FilePutClassfication>('filePUT', this.getTelemetryData(e.model.resource, e.reason));
170176
}

0 commit comments

Comments
 (0)