diff --git a/shared/src/commands/commands.ts b/shared/src/commands/commands.ts index 021bde9221b8..6ec89356b16b 100644 --- a/shared/src/commands/commands.ts +++ b/shared/src/commands/commands.ts @@ -15,7 +15,7 @@ import { PlatformContext } from '../platform/context' */ export function registerBuiltinClientCommands( { settings: settingsService, commands: commandRegistry, textDocumentLocations }: Services, - context: Pick + context: Pick ): Unsubscribable { const subscription = new Subscription() @@ -102,6 +102,21 @@ export function registerBuiltinClientCommands( }) ) + /** + * Sends a telemetry event to the Sourcegraph instance with the correct anonymous user id. + */ + subscription.add( + commandRegistry.registerCommand({ + command: 'logTelemetryEvent', + run: (eventName: string, eventProperties?: any): Promise => { + if (context.telemetryService) { + context.telemetryService.log(eventName, eventProperties) + } + return Promise.resolve() + }, + }) + ) + return subscription }