Skip to content

Commit

Permalink
Add owner/comments to telemetry events
Browse files Browse the repository at this point in the history
Also removes one event that is no longer useful
  • Loading branch information
mjbvz committed Mar 3, 2022
1 parent 7a9b2ba commit 95ba1e1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ export async function applyCodeAction(
codeActionIsPreferred: boolean;
};
type ApplyCodeEventClassification = {
codeActionTitle: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
codeActionKind: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
codeActionIsPreferred: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
codeActionTitle: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; owner: 'mjbvz'; comment: 'The display label of the applied code action' };
codeActionKind: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; owner: 'mjbvz'; comment: 'The kind (refactor, quickfix) of the applied code action' };
codeActionIsPreferred: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; owner: 'mjbvz'; comment: 'Was the code action marked as being a preferred action?' };
};

telemetryService.publicLog2<ApplyCodeActionEvent, ApplyCodeEventClassification>('codeAction.applyCodeAction', {
Expand Down
17 changes: 9 additions & 8 deletions src/vs/workbench/api/browser/mainThreadWebviewPanels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,17 @@ export class MainThreadWebviewPanels extends Disposable implements extHostProtoc
const webview = this._webviewWorkbenchService.createWebview(handle, this.webviewPanelViewType.fromExternal(viewType), initData.title, mainThreadShowOptions, reviveWebviewOptions(initData.panelOptions), reviveWebviewContentOptions(initData.webviewOptions), extension);
this.addWebviewInput(handle, webview, { serializeBuffersForPostMessage: initData.serializeBuffersForPostMessage });

/* __GDPR__
"webviews:createWebviewPanel" : {
"extensionId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"viewType" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
this._telemetryService.publicLog('webviews:createWebviewPanel', {
const payload = {
extensionId: extension.id.value,
viewType
});
} as const;

type Classification = {
extensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; owner: 'mjbvz'; comment: 'Id of the extension that created the webview panel' };
viewType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; owner: 'mjbvz'; comment: 'Id of the webview' };
};

this._telemetryService.publicLog2<typeof payload, Classification>('webviews:createWebviewPanel', payload);
}

public $disposeWebview(handle: extHostProtocol.WebviewHandle): void {
Expand Down
26 changes: 7 additions & 19 deletions src/vs/workbench/contrib/webview/browser/webviewElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,17 +328,6 @@ export class WebviewElement extends Disposable implements IWebview, WebviewFindD

this._register(Event.runAndSubscribe(webviewThemeDataProvider.onThemeDataChanged, () => this.style()));

/* __GDPR__
"webview.createWebview" : {
"extension": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
"webviewElementType": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
}
*/
this._telemetryService.publicLog('webview.createWebview', {
extension: extension?.id.value,
webviewElementType: 'iframe',
});

this._confirmBeforeClose = configurationService.getValue<string>('window.confirmBeforeClose');

this._register(configurationService.onDidChangeConfiguration(e => {
Expand Down Expand Up @@ -523,16 +512,15 @@ export class WebviewElement extends Disposable implements IWebview, WebviewFindD
this._onMissingCsp.fire(this.extension.id);
}

type TelemetryClassification = {
extension?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight' };
};
type TelemetryData = {
extension?: string;
const payload = {
extension: this.extension.id.value
} as const;

type Classification = {
extension: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; owner: 'mjbvz'; comment: 'The id of the extension that created the webview.' };
};

this._telemetryService.publicLog2<TelemetryData, TelemetryClassification>('webviewMissingCsp', {
extension: this.extension.id.value
});
this._telemetryService.publicLog2<typeof payload, Classification>('webviewMissingCsp', payload);
}
}

Expand Down

0 comments on commit 95ba1e1

Please sign in to comment.