Merge from vscode 52dcb723a39ae75bee1bd56b3312d7fcdc87aeed (#6719)

This commit is contained in:
Anthony Dresser
2019-08-12 21:31:51 -07:00
committed by GitHub
parent 00250839fc
commit 7eba8c4c03
616 changed files with 9472 additions and 7087 deletions

View File

@@ -15,67 +15,10 @@ import { ClassifiedEvent, StrictPropertyCheck, GDPRClassification } from 'vs/pla
import { IStorageService } from 'vs/platform/storage/common/storage';
import { resolveWorkbenchCommonProperties } from 'vs/platform/telemetry/browser/workbenchCommonProperties';
import { IProductService } from 'vs/platform/product/common/product';
interface IConfig {
instrumentationKey?: string;
endpointUrl?: string;
emitLineDelimitedJson?: boolean;
accountId?: string;
sessionRenewalMs?: number;
sessionExpirationMs?: number;
maxBatchSizeInBytes?: number;
maxBatchInterval?: number;
enableDebug?: boolean;
disableExceptionTracking?: boolean;
disableTelemetry?: boolean;
verboseLogging?: boolean;
diagnosticLogInterval?: number;
samplingPercentage?: number;
autoTrackPageVisitTime?: boolean;
disableAjaxTracking?: boolean;
overridePageViewDuration?: boolean;
maxAjaxCallsPerView?: number;
disableDataLossAnalysis?: boolean;
disableCorrelationHeaders?: boolean;
correlationHeaderExcludedDomains?: string[];
disableFlushOnBeforeUnload?: boolean;
enableSessionStorageBuffer?: boolean;
isCookieUseDisabled?: boolean;
cookieDomain?: string;
isRetryDisabled?: boolean;
url?: string;
isStorageUseDisabled?: boolean;
isBeaconApiDisabled?: boolean;
sdkExtension?: string;
isBrowserLinkTrackingEnabled?: boolean;
appId?: string;
enableCorsCorrelation?: boolean;
}
declare class Microsoft {
public static ApplicationInsights: {
Initialization: {
new(init: { config: IConfig }): AppInsights;
}
};
}
declare interface IAppInsightsClient {
config: IConfig;
/** Log a user action or other occurrence. */
trackEvent: (name: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) => void;
/** Immediately send all queued telemetry. Synchronous. */
flush(): void;
}
interface AppInsights {
loadAppInsights: () => IAppInsightsClient;
}
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
export class WebTelemetryAppender implements ITelemetryAppender {
private _aiClient?: IAppInsightsClient;
private _aiClient?: ApplicationInsights;
constructor(aiKey: string, private _logService: ILogService) {
const initConfig = {
@@ -89,8 +32,8 @@ export class WebTelemetryAppender implements ITelemetryAppender {
}
};
const appInsights = new Microsoft.ApplicationInsights.Initialization(initConfig);
this._aiClient = appInsights.loadAppInsights();
this._aiClient = new ApplicationInsights(initConfig);
this._aiClient.loadAppInsights();
}
log(eventName: string, data: any): void {
@@ -101,7 +44,11 @@ export class WebTelemetryAppender implements ITelemetryAppender {
data = validateTelemetryData(data);
this._logService.trace(`telemetry/${eventName}`, data);
this._aiClient.trackEvent('monacoworkbench/' + eventName, data.properties, data.measurements);
this._aiClient.trackEvent({
name: 'monacoworkbench/' + eventName,
properties: data.properties,
measurements: data.measurements
});
}
flush(): Promise<any> | undefined {
@@ -167,4 +114,4 @@ export class TelemetryService extends Disposable implements ITelemetryService {
}
}
registerSingleton(ITelemetryService, TelemetryService);
registerSingleton(ITelemetryService, TelemetryService);