@@ -15,67 +15,10 @@ import { ClassifiedEvent, StrictPropertyCheck, GDPRClassification } from 'vs/pla
1515import { IStorageService } from 'vs/platform/storage/common/storage' ;
1616import { resolveWorkbenchCommonProperties } from 'vs/platform/telemetry/browser/workbenchCommonProperties' ;
1717import { IProductService } from 'vs/platform/product/common/product' ;
18-
19- interface IConfig {
20- instrumentationKey ?: string ;
21- endpointUrl ?: string ;
22- emitLineDelimitedJson ?: boolean ;
23- accountId ?: string ;
24- sessionRenewalMs ?: number ;
25- sessionExpirationMs ?: number ;
26- maxBatchSizeInBytes ?: number ;
27- maxBatchInterval ?: number ;
28- enableDebug ?: boolean ;
29- disableExceptionTracking ?: boolean ;
30- disableTelemetry ?: boolean ;
31- verboseLogging ?: boolean ;
32- diagnosticLogInterval ?: number ;
33- samplingPercentage ?: number ;
34- autoTrackPageVisitTime ?: boolean ;
35- disableAjaxTracking ?: boolean ;
36- overridePageViewDuration ?: boolean ;
37- maxAjaxCallsPerView ?: number ;
38- disableDataLossAnalysis ?: boolean ;
39- disableCorrelationHeaders ?: boolean ;
40- correlationHeaderExcludedDomains ?: string [ ] ;
41- disableFlushOnBeforeUnload ?: boolean ;
42- enableSessionStorageBuffer ?: boolean ;
43- isCookieUseDisabled ?: boolean ;
44- cookieDomain ?: string ;
45- isRetryDisabled ?: boolean ;
46- url ?: string ;
47- isStorageUseDisabled ?: boolean ;
48- isBeaconApiDisabled ?: boolean ;
49- sdkExtension ?: string ;
50- isBrowserLinkTrackingEnabled ?: boolean ;
51- appId ?: string ;
52- enableCorsCorrelation ?: boolean ;
53- }
54-
55- declare class Microsoft {
56- public static ApplicationInsights : {
57- Initialization : {
58- new ( init : { config : IConfig } ) : AppInsights ;
59- }
60- } ;
61- }
62-
63- declare interface IAppInsightsClient {
64- config : IConfig ;
65-
66- /** Log a user action or other occurrence. */
67- trackEvent : ( name : string , properties ?: { [ key : string ] : string } , measurements ?: { [ key : string ] : number } ) => void ;
68-
69- /** Immediately send all queued telemetry. Synchronous. */
70- flush ( ) : void ;
71- }
72-
73- interface AppInsights {
74- loadAppInsights : ( ) => IAppInsightsClient ;
75- }
18+ import { ApplicationInsights } from 'applicationinsights-web' ;
7619
7720export class WebTelemetryAppender implements ITelemetryAppender {
78- private _aiClient ?: IAppInsightsClient ;
21+ private _aiClient ?: ApplicationInsights ;
7922
8023 constructor ( aiKey : string , private _logService : ILogService ) {
8124 const initConfig = {
@@ -89,8 +32,8 @@ export class WebTelemetryAppender implements ITelemetryAppender {
8932 }
9033 } ;
9134
92- const appInsights = new Microsoft . ApplicationInsights . Initialization ( initConfig ) ;
93- this . _aiClient = appInsights . loadAppInsights ( ) ;
35+ this . _aiClient = new ApplicationInsights ( initConfig ) ;
36+ this . _aiClient . loadAppInsights ( ) ;
9437 }
9538
9639 log ( eventName : string , data : any ) : void {
@@ -101,7 +44,11 @@ export class WebTelemetryAppender implements ITelemetryAppender {
10144 data = validateTelemetryData ( data ) ;
10245 this . _logService . trace ( `telemetry/${ eventName } ` , data ) ;
10346
104- this . _aiClient . trackEvent ( 'monacoworkbench/' + eventName , data . properties , data . measurements ) ;
47+ this . _aiClient . trackEvent ( {
48+ name : 'monacoworkbench/' + eventName ,
49+ properties : data . properties ,
50+ measurements : data . measurements
51+ } ) ;
10552 }
10653
10754 flush ( ) : Promise < void > {
@@ -167,4 +114,4 @@ export class TelemetryService extends Disposable implements ITelemetryService {
167114 }
168115}
169116
170- registerSingleton ( ITelemetryService , TelemetryService ) ;
117+ registerSingleton ( ITelemetryService , TelemetryService ) ;
0 commit comments