@@ -7,11 +7,12 @@ import type { AppInsightsCore, IExtendedConfiguration } from '@microsoft/1ds-cor
7
7
import type { IChannelConfiguration , IXHROverride , PostChannel } from '@microsoft/1ds-post-js' ;
8
8
import { onUnexpectedError } from 'vs/base/common/errors' ;
9
9
import { mixin } from 'vs/base/common/objects' ;
10
+ import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
10
11
import { ITelemetryAppender , validateTelemetryData } from 'vs/platform/telemetry/common/telemetryUtils' ;
11
12
12
13
const endpointUrl = 'https://mobile.events.data.microsoft.com/OneCollector/1.0' ;
13
14
14
- async function getClient ( instrumentationKey : string , xhrOverride ?: IXHROverride ) : Promise < AppInsightsCore > {
15
+ async function getClient ( instrumentationKey : string , addInternalFlag ?: boolean , xhrOverride ?: IXHROverride ) : Promise < AppInsightsCore > {
15
16
const oneDs = await import ( '@microsoft/1ds-core-js' ) ;
16
17
const postPlugin = await import ( '@microsoft/1ds-post-js' ) ;
17
18
const appInsightsCore = new oneDs . AppInsightsCore ( ) ;
@@ -43,10 +44,12 @@ async function getClient(instrumentationKey: string, xhrOverride?: IXHROverride)
43
44
appInsightsCore . initialize ( coreConfig , [ ] ) ;
44
45
45
46
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
+ }
50
53
} ) ;
51
54
52
55
return appInsightsCore ;
@@ -60,6 +63,7 @@ export abstract class AbstractOneDataSystemAppender implements ITelemetryAppende
60
63
protected readonly endPointUrl = endpointUrl ;
61
64
62
65
constructor (
66
+ private readonly _configurationService : IConfigurationService ,
63
67
private _eventPrefix : string ,
64
68
private _defaultData : { [ key : string ] : any } | null ,
65
69
iKeyOrClientFactory : string | ( ( ) => AppInsightsCore ) , // allow factory function for testing
@@ -88,7 +92,8 @@ export abstract class AbstractOneDataSystemAppender implements ITelemetryAppende
88
92
}
89
93
90
94
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 ) ;
92
97
}
93
98
94
99
this . _asyncAiCore . then (
0 commit comments