Skip to content

Commit

Permalink
Add remote machine ID to telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
code-asher committed May 7, 2024
1 parent 9765315 commit 0f4791b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions patches/telemetry.diff
Expand Up @@ -42,15 +42,15 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
- if (!isLoggingOnly(productService, environmentService) && productService.aiConfig?.ariaKey) {
- oneDsAppender = new OneDataSystemAppender(requestService, isInternal, eventPrefix, null, productService.aiConfig.ariaKey);
+ if (!isLoggingOnly(productService, environmentService) && productService.telemetryEndpoint) {
+ oneDsAppender = new OneDataSystemAppender(requestService, isInternal, eventPrefix, null, () => new TelemetryClient(productService.telemetryEndpoint!, isContainer));
+ oneDsAppender = new OneDataSystemAppender(requestService, isInternal, eventPrefix, null, () => new TelemetryClient(productService.telemetryEndpoint!, machineId, isContainer));
disposables.add(toDisposable(() => oneDsAppender?.flush())); // Ensure the AI appender is disposed so that it flushes remaining data
}

Index: code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
===================================================================
--- /dev/null
+++ code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
@@ -0,0 +1,53 @@
@@ -0,0 +1,55 @@
+import { AppInsightsCore, IExtendedTelemetryItem, ITelemetryItem } from '@microsoft/1ds-core-js';
+import * as https from 'https';
+import * as http from 'http';
Expand All @@ -59,6 +59,7 @@ Index: code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
+export class TelemetryClient extends AppInsightsCore {
+ public constructor(
+ private readonly endpoint: string,
+ private readonly machineId: string,
+ private readonly isContainer: Boolean | undefined) {
+ super();
+ }
Expand Down Expand Up @@ -89,6 +90,7 @@ Index: code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
+ options.properties['common.arch'] = os.arch();
+ } catch (error) {}
+
+ options.properties['common.remoteMachineId'] = this.machineId;
+ options.properties['common.isContainer'] = this.isContainer;
+
+ try {
Expand Down

0 comments on commit 0f4791b

Please sign in to comment.