|
3 | 3 | *--------------------------------------------------------*/
|
4 | 4 |
|
5 | 5 | import * as vscode from "vscode";
|
| 6 | +import type { TelemetryEventMeasurements, TelemetryEventProperties } from "../../lib/telemetryReporter"; |
6 | 7 |
|
| 8 | +export interface AppenderData { |
| 9 | + properties?: TelemetryEventProperties, |
| 10 | + measurements?: TelemetryEventMeasurements |
| 11 | +} |
7 | 12 | export interface ITelemetryAppender {
|
8 |
| - logEvent(eventName: string, data?: any): void; |
9 |
| - logException(exception: Error, data?: any): void; |
| 13 | + logEvent(eventName: string, data?: AppenderData): void; |
| 14 | + logException(exception: Error, data?: AppenderData): void; |
10 | 15 | flush(): void | Promise<void>;
|
11 | 16 | }
|
12 | 17 |
|
@@ -133,7 +138,7 @@ export class BaseTelemtryReporter {
|
133 | 138 | // __GDPR__COMMON__ "common.uikind" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
134 | 139 | // __GDPR__COMMON__ "common.remotename" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
135 | 140 | // __GDPR__COMMON__ "common.isnewappinstall" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
136 |
| - private getCommonProperties(): { [key: string]: string } { |
| 141 | + private getCommonProperties(): TelemetryEventProperties { |
137 | 142 | const commonProperties = Object.create(null);
|
138 | 143 | commonProperties["common.os"] = this.osShim.platform;
|
139 | 144 | commonProperties["common.platformversion"] = (this.osShim.release || "").replace(/^(\d+)(\.\d+)?(\.\d+)?(.*)/, "$1$2$3");
|
@@ -221,7 +226,7 @@ export class BaseTelemtryReporter {
|
221 | 226 | return updatedStack;
|
222 | 227 | }
|
223 | 228 |
|
224 |
| - private removePropertiesWithPossibleUserInfo(properties: { [key: string]: string } | undefined): { [key: string]: string } | undefined { |
| 229 | + private removePropertiesWithPossibleUserInfo(properties: TelemetryEventProperties | undefined): TelemetryEventProperties | undefined { |
225 | 230 | if (typeof properties !== "object") {
|
226 | 231 | return;
|
227 | 232 | }
|
@@ -257,7 +262,7 @@ export class BaseTelemtryReporter {
|
257 | 262 | * @param properties The properties to send with the event
|
258 | 263 | * @param measurements The measurements (numeric values) to send with the event
|
259 | 264 | */
|
260 |
| - public sendTelemetryEvent(eventName: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }): void { |
| 265 | + public sendTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void { |
261 | 266 | if (this.userOptIn && eventName !== "") {
|
262 | 267 | properties = { ...properties, ...this.getCommonProperties() };
|
263 | 268 | const cleanProperties = this.cloneAndChange(properties, (_key: string, prop: string) => this.anonymizeFilePaths(prop, this.firstParty));
|
@@ -299,7 +304,7 @@ export class BaseTelemtryReporter {
|
299 | 304 | * @param properties The properties to send with the event
|
300 | 305 | * @param measurements The measurements (numeric values) to send with the event
|
301 | 306 | */
|
302 |
| - public sendTelemetryException(error: Error, properties?: { [key: string]: string }, measurements?: { [key: string]: number }): void { |
| 307 | + public sendTelemetryException(error: Error, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void { |
303 | 308 | if (this.shouldSendErrorTelemetry() && this.userOptIn && error) {
|
304 | 309 | properties = { ...properties, ...this.getCommonProperties() };
|
305 | 310 | const cleanProperties = this.cloneAndChange(properties, (_key: string, prop: string) => this.anonymizeFilePaths(prop, this.firstParty));
|
|
0 commit comments