1dsAppender.ts ×11

Frontier kind: Joint frontier

unlabeled · c_7c6958f47ab8

1 test · 20842 LOC · 91 files · introduces 1 test · 106 LOC · 4 files

Introduces — evidence that enters the hierarchy at this concept

Code
18 ranges106 lines · 4 files
Tests
1 test

Contains — complete concept membership

All code (extent)
3078 ranges20842 lines · 91 files · Browse complete extent
All tests (intent)
1 testBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

1 test introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

4 files ranked by introduced lines: 106 introduced LOC across 18 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/telemetry/common/1dsAppender.ts 80 introduced LOC · 11 ranges

Open complete file

23 const endpointHealthUrl = 'https://mobile.events.data.microsoft.com/ping';
24
25 > async function getClient(instrumentationKey: string, addInternalFlag?: boolean, xhrOverride?: IXHROverride): Promise<IAppInsightsCore> { 1dsAppender.ts
26 > // eslint-disable-next-line local/code-amd-node-module
27 > const oneDs = isWeb ? await importAMDNodeModule<typeof import('@microsoft/1ds-core-js')>('@microsoft/1ds-core-js', 'bundle/ms.core.min.js') : await import('@microsoft/1ds-core-js');
28 > // eslint-disable-next-line local/code-amd-node-module
29 > const postPlugin = isWeb ? await importAMDNodeModule<typeof import('@microsoft/1ds-post-js')>('@microsoft/1ds-post-js', 'bundle/ms.post.min.js') : await import('@microsoft/1ds-post-js');
30 >
31 > const appInsightsCore = new oneDs.AppInsightsCore();
32 > const collectorChannelPlugin: PostChannel = new postPlugin.PostChannel();
33 > // Configure the app insights core to send to collector++ and disable logging of debug info
34 > const coreConfig: IExtendedConfiguration = {
35 > instrumentationKey,
36 > endpointUrl,
37 > loggingLevelTelemetry: 0,
38 > loggingLevelConsole: 0,
39 > disableCookiesUsage: true,
40 > disableDbgExt: true,
41 > disableInstrumentationKeyValidation: true,
42 > channels: [[
43 > collectorChannelPlugin
44 > ]]
45 > };
46 >
47 > if (xhrOverride) {
48 > coreConfig.extensionConfig = {};
49 > // Configure the channel to use a XHR Request override since it's not available in node
50 > const channelConfig: IChannelConfiguration = {
51 > alwaysUseXhrOverride: true,
52 > ignoreMc1Ms0CookieProcessing: true,
53 > httpXHROverride: xhrOverride
54 > };
55 > coreConfig.extensionConfig[collectorChannelPlugin.identifier] = channelConfig;
56 > }
57 >
58 > appInsightsCore.initialize(coreConfig, []);
59 >
60 > appInsightsCore.addTelemetryInitializer((envelope) => {
61 // Opt the user out of 1DS data sharing
62 envelope['ext'] = envelope['ext'] ?? {};
69 envelope['ext']['utc']['flags'] = 0x0000811ECD;
70 }
71 > }); 1dsAppender.ts
72 >
73 > return appInsightsCore;
74 > }
75
76 // TODO @lramos15 maybe make more in line with src/vs/platform/telemetry/browser/appInsightsAppender.ts with caching support
83
84 constructor(
85 > private readonly _isInternalTelemetry: boolean, 1dsAppender.ts
86 > private _eventPrefix: string,
87 > private _defaultData: { [key: string]: unknown } | null,
88 > iKeyOrClientFactory: string | (() => IAppInsightsCore), // allow factory function for testing
89 > private _xhrOverride?: IXHROverride
90 > ) {
91 > if (!this._defaultData) {
92 > this._defaultData = {};
93 > }
94 >
95 > if (typeof iKeyOrClientFactory === 'function') {
96 this._aiCoreOrKey = iKeyOrClientFactory();
97 > } else { 1dsAppender.ts
98 > this._aiCoreOrKey = iKeyOrClientFactory;
99 > }
100 > this._asyncAiCore = null;
101 > }
102
103 private _withAIClient(callback: (aiCore: IAppInsightsCore) => void): void {
104 > if (!this._aiCoreOrKey) { 1dsAppender.ts
105 return;
106 }
108 > if (typeof this._aiCoreOrKey !== 'string') {
109 callback(this._aiCoreOrKey);
110 return;
111 }
113 > if (!this._asyncAiCore) {
114 > this._asyncAiCore = getClient(this._aiCoreOrKey, this._isInternalTelemetry, this._xhrOverride);
115 > }
116 >
117 > this._asyncAiCore.then(
118 > (aiClient) => {
119 > callback(aiClient);
120 > },
121 > (err) => {
122 onUnexpectedError(err);
123 console.error(err);
124 }
125 > ); 1dsAppender.ts
126 > }
127
128 log(eventName: string, data?: unknown): void {
146
147 flush(): Promise<void> {
148 > if (this._aiCoreOrKey) { 1dsAppender.ts
149 > return new Promise(resolve => {
150 > this._withAIClient((aiClient) => {
151 > aiClient.unload(true, () => {
152 this._aiCoreOrKey = undefined;
153 resolve(undefined);
154 > }); 1dsAppender.ts
155 > });
156 > });
157 > }
158 return Promise.resolve(undefined);
159 > } 1dsAppender.ts
160 }
src/vs/platform/telemetry/node/1dsAppender.ts 13 introduced LOC · 2 ranges

Open complete file

99
100 constructor(
101 > requestService: IRequestService | undefined, 1dsAppender.ts
102 > isInternalTelemetry: boolean,
103 > eventPrefix: string,
104 > defaultData: { [key: string]: unknown } | null,
105 > iKeyOrClientFactory: string | (() => IAppInsightsCore), // allow factory function for testing
106 > ) {
107 > // Override the way events get sent since node doesn't have XHTMLRequest
108 > const customHttpXHROverride: IXHROverride = {
109 > sendPOST: (payload: IPayloadData, oncomplete: OnCompleteFunc) => {
110 // Fire off the async request without awaiting it
111 sendPostAsync(requestService, payload, oncomplete);
112 }
113 > }; 1dsAppender.ts
114 >
115 > super(isInternalTelemetry, eventPrefix, defaultData, iKeyOrClientFactory, customHttpXHROverride);
116 > }
117 }
src/vs/platform/agentHost/node/agentHostTelemetryService.ts 11 introduced LOC · 4 ranges

Open complete file

208 }
209
210 > async function resolveCopilotExtensionVersion(environmentService: INativeEnvironmentService, fileService: IFileService, logService: ILogService): Promise<string | undefined> { agentHostTelemetryService.ts
211 > if (!environmentService.builtinExtensionsPath) {
212 return undefined;
213 }
215 > const manifest = JSON.parse((await fileService.readFile(joinPath(URI.file(environmentService.builtinExtensionsPath), 'copilot', 'package.json'))).value.toString()) as { version?: unknown };
216 > return typeof manifest.version === 'string' ? manifest.version : undefined;
217 > } catch (error) {
218 logService.debug(`[agentHostTelemetry] Failed to resolve Copilot extension version: ${error instanceof Error ? error.message : String(error)}`);
219 return undefined;
220 }
222
223 export async function createAgentHostTelemetryService(options: IAgentHostTelemetryServiceOptions): Promise<IAgentHostTelemetryService> {
236 const loggingOnly = isLoggingOnly(productService, environmentService);
237 if (!loggingOnly && productService.aiConfig?.ariaKey) {
238 > const collectorAppender = new OneDataSystemAppender(options.requestService, internalTelemetry, 'monacoworkbench', null, productService.aiConfig.ariaKey); agentHostTelemetryService.ts
239 > disposables.add(toDisposable(() => { void collectorAppender.flush(); }));
240 > appenders.push(collectorAppender);
241 > }
242
243 // Prefer the host-forwarded identifiers (see `agentHostTelemetryEnv`) so the
src/vs/platform/telemetry/common/telemetryUtils.ts 2 introduced LOC · 1 range

Open complete file

116 // Logging only mode is only for OSS
117 if (environmentService.isBuilt) {
118 > return false; telemetryUtils.ts
119 > }
120
121 if (environmentService.disableTelemetry) {