Move telemetry endpoint to product service

This will let us use it in the client.
This commit is contained in:
Asher 2024-05-06 16:58:07 -08:00
parent 125a972c81
commit 2633bca30b
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
3 changed files with 33 additions and 6 deletions

View File

@ -30,7 +30,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
import { ProtocolConstants } from 'vs/base/parts/ipc/common/ipc.net'; import { ProtocolConstants } from 'vs/base/parts/ipc/common/ipc.net';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ConfigurationService } from 'vs/platform/configuration/common/configurationService'; import { ConfigurationService } from 'vs/platform/configuration/common/configurationService';
@@ -239,6 +239,9 @@ export async function setupServerService @@ -240,6 +240,9 @@ export async function setupServerService
const channel = new ExtensionManagementChannel(extensionManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority)); const channel = new ExtensionManagementChannel(extensionManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority));
socketServer.registerChannel('extensions', channel); socketServer.registerChannel('extensions', channel);
@ -220,7 +220,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
import { CharCode } from 'vs/base/common/charCode'; import { CharCode } from 'vs/base/common/charCode';
import { IExtensionManifest } from 'vs/platform/extensions/common/extensions'; import { IExtensionManifest } from 'vs/platform/extensions/common/extensions';
@@ -347,6 +348,8 @@ export class WebClientServer { @@ -348,6 +349,8 @@ export class WebClientServer {
callbackRoute: this._callbackRoute callbackRoute: this._callbackRoute
}; };
@ -229,7 +229,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
const nlsBaseUrl = this._productService.extensionsGallery?.nlsBaseUrl; const nlsBaseUrl = this._productService.extensionsGallery?.nlsBaseUrl;
const values: { [key: string]: string } = { const values: { [key: string]: string } = {
WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration), WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
@@ -355,6 +358,7 @@ export class WebClientServer { @@ -356,6 +359,7 @@ export class WebClientServer {
WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : ''), WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : ''),
BASE: base, BASE: base,
VS_BASE: vscodeBase, VS_BASE: vscodeBase,

View File

@ -201,7 +201,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -338,6 +338,7 @@ export class WebClientServer { @@ -339,6 +339,7 @@ export class WebClientServer {
userDataPath: this._environmentService.userDataPath, userDataPath: this._environmentService.userDataPath,
isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'], isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],
isEnabledFileUploads: !this._environmentService.args['disable-file-uploads'], isEnabledFileUploads: !this._environmentService.args['disable-file-uploads'],

View File

@ -40,7 +40,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
const isInternal = isInternalTelemetry(productService, configurationService); const isInternal = isInternalTelemetry(productService, configurationService);
if (supportsTelemetry(productService, environmentService)) { if (supportsTelemetry(productService, environmentService)) {
- if (!isLoggingOnly(productService, environmentService) && productService.aiConfig?.ariaKey) { - if (!isLoggingOnly(productService, environmentService) && productService.aiConfig?.ariaKey) {
+ const telemetryEndpoint = process.env.CS_TELEMETRY_URL || "https://v1.telemetry.coder.com/track"; + const telemetryEndpoint = productService.telemetryEndpoint;
+ if (telemetryEndpoint) { + if (telemetryEndpoint) {
+ oneDsAppender = new OneDataSystemAppender(requestService, false, eventPrefix, null, () => new TelemetryClient(telemetryEndpoint, isContainer)); + oneDsAppender = new OneDataSystemAppender(requestService, false, eventPrefix, null, () => new TelemetryClient(telemetryEndpoint, isContainer));
+ } else if (!isLoggingOnly(productService, environmentService) && productService.aiConfig?.ariaKey) { + } else if (!isLoggingOnly(productService, environmentService) && productService.aiConfig?.ariaKey) {
@ -109,11 +109,38 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts +++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -318,6 +318,7 @@ export class WebClientServer { @@ -318,6 +318,8 @@ export class WebClientServer {
scope: vscodeBase + '/', scope: vscodeBase + '/',
path: base + '/_static/out/browser/serviceWorker.js', path: base + '/_static/out/browser/serviceWorker.js',
}, },
+ enableTelemetry: this._productService.enableTelemetry, + enableTelemetry: this._productService.enableTelemetry,
+ telemetryEndpoint: this._productService.telemetryEndpoint,
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery, extensionsGallery: this._productService.extensionsGallery,
}; };
Index: code-server/lib/vscode/src/vs/base/common/product.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts
+++ code-server/lib/vscode/src/vs/base/common/product.ts
@@ -64,6 +64,7 @@ export interface IProductConfiguration {
readonly path: string;
readonly scope: string;
}
+ readonly telemetryEndpoint?: string
readonly version: string;
readonly date?: string;
Index: code-server/lib/vscode/src/vs/platform/product/common/product.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/product/common/product.ts
+++ code-server/lib/vscode/src/vs/platform/product/common/product.ts
@@ -55,7 +55,8 @@ else if (globalThis._VSCODE_PRODUCT_JSON
resourceUrlTemplate: "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",
controlUrl: "",
recommendationsUrl: "",
- })
+ }),
+ telemetryEndpoint: env.CS_TELEMETRY_URL || product.telemetryEndpoint || "https://v1.telemetry.coder.com/track",
});
}