@@ -7,11 +7,12 @@ import type { AppInsightsCore, IExtendedConfiguration } from '@microsoft/1ds-cor
77import type { IChannelConfiguration , IXHROverride , PostChannel } from '@microsoft/1ds-post-js' ;
88import { onUnexpectedError } from 'vs/base/common/errors' ;
99import { mixin } from 'vs/base/common/objects' ;
10+ import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
1011import { ITelemetryAppender , validateTelemetryData } from 'vs/platform/telemetry/common/telemetryUtils' ;
1112
1213const endpointUrl = 'https://mobile.events.data.microsoft.com/OneCollector/1.0' ;
1314
14- async function getClient ( instrumentationKey : string , xhrOverride ?: IXHROverride ) : Promise < AppInsightsCore > {
15+ async function getClient ( instrumentationKey : string , addInternalFlag ?: boolean , xhrOverride ?: IXHROverride ) : Promise < AppInsightsCore > {
1516 const oneDs = await import ( '@microsoft/1ds-core-js' ) ;
1617 const postPlugin = await import ( '@microsoft/1ds-post-js' ) ;
1718 const appInsightsCore = new oneDs . AppInsightsCore ( ) ;
@@ -43,10 +44,12 @@ async function getClient(instrumentationKey: string, xhrOverride?: IXHROverride)
4344 appInsightsCore . initialize ( coreConfig , [ ] ) ;
4445
4546 appInsightsCore . addTelemetryInitializer ( ( envelope ) => {
46- envelope [ 'ext' ] = envelope [ 'ext' ] ?? { } ;
47- envelope [ 'ext' ] [ 'utc' ] = envelope [ 'ext' ] [ 'utc' ] ?? { } ;
48- // Sets it to be internal only based on Windows UTC flagging
49- envelope [ 'ext' ] [ 'utc' ] [ 'flags' ] = 0x0000811ECD ;
47+ if ( addInternalFlag ) {
48+ envelope [ 'ext' ] = envelope [ 'ext' ] ?? { } ;
49+ envelope [ 'ext' ] [ 'utc' ] = envelope [ 'ext' ] [ 'utc' ] ?? { } ;
50+ // Sets it to be internal only based on Windows UTC flagging
51+ envelope [ 'ext' ] [ 'utc' ] [ 'flags' ] = 0x0000811ECD ;
52+ }
5053 } ) ;
5154
5255 return appInsightsCore ;
@@ -60,6 +63,7 @@ export abstract class AbstractOneDataSystemAppender implements ITelemetryAppende
6063 protected readonly endPointUrl = endpointUrl ;
6164
6265 constructor (
66+ private readonly _configurationService : IConfigurationService ,
6367 private _eventPrefix : string ,
6468 private _defaultData : { [ key : string ] : any } | null ,
6569 iKeyOrClientFactory : string | ( ( ) => AppInsightsCore ) , // allow factory function for testing
@@ -88,7 +92,8 @@ export abstract class AbstractOneDataSystemAppender implements ITelemetryAppende
8892 }
8993
9094 if ( ! this . _asyncAiCore ) {
91- this . _asyncAiCore = getClient ( this . _aiCoreOrKey , this . _xhrOverride ) ;
95+ const isInternal = this . _configurationService . getValue < boolean > ( 'telemetry.internalTesting' ) ;
96+ this . _asyncAiCore = getClient ( this . _aiCoreOrKey , isInternal , this . _xhrOverride ) ;
9297 }
9398
9499 this . _asyncAiCore . then (
0 commit comments