diff --git a/src/client/activation/node/manager.ts b/src/client/activation/node/manager.ts index 85d57622e327..b85d8fe6ed14 100644 --- a/src/client/activation/node/manager.ts +++ b/src/client/activation/node/manager.ts @@ -7,7 +7,7 @@ import { IDisposable, IExtensions, Resource } from '../../common/types'; import { debounceSync } from '../../common/utils/decorators'; import { IServiceContainer } from '../../ioc/types'; import { PythonEnvironment } from '../../pythonEnvironments/info'; -import { captureTelemetry } from '../../telemetry'; +import { captureTelemetry, sendTelemetryEvent } from '../../telemetry'; import { EventName } from '../../telemetry/constants'; import { Commands } from '../commands'; import { NodeLanguageClientMiddleware } from './languageClientMiddleware'; @@ -44,6 +44,7 @@ export class NodeLanguageServerManager implements ILanguageServerManager { NodeLanguageServerManager.commandDispose.dispose(); } NodeLanguageServerManager.commandDispose = commandManager.registerCommand(Commands.RestartLS, () => { + sendTelemetryEvent(EventName.LANGUAGE_SERVER_RESTART, undefined, { reason: 'command' }); this.restartLanguageServer().ignoreErrors(); }); } @@ -94,6 +95,7 @@ export class NodeLanguageServerManager implements ILanguageServerManager { @debounceSync(1000) protected restartLanguageServerDebounced(): void { + sendTelemetryEvent(EventName.LANGUAGE_SERVER_RESTART, undefined, { reason: 'settings' }); this.restartLanguageServer().ignoreErrors(); } diff --git a/src/client/languageServer/watcher.ts b/src/client/languageServer/watcher.ts index c71c33b7ad28..8ed4a3e27334 100644 --- a/src/client/languageServer/watcher.ts +++ b/src/client/languageServer/watcher.ts @@ -28,6 +28,8 @@ import { NoneLSExtensionManager } from './noneLSExtensionManager'; import { PylanceLSExtensionManager } from './pylanceLSExtensionManager'; import { ILanguageServerExtensionManager, ILanguageServerWatcher } from './types'; import { LspNotebooksExperiment } from '../activation/node/lspNotebooksExperiment'; +import { sendTelemetryEvent } from '../telemetry'; +import { EventName } from '../telemetry/constants'; @injectable() /** @@ -184,6 +186,7 @@ export class LanguageServerWatcher implements IExtensionActivationService, ILang public async restartLanguageServers(): Promise { this.workspaceLanguageServers.forEach(async (_, resourceString) => { + sendTelemetryEvent(EventName.LANGUAGE_SERVER_RESTART, undefined, { reason: 'notebooksExperiment' }); const resource = Uri.parse(resourceString); await this.stopLanguageServer(resource); await this.startLanguageServer(this.languageServerType, resource); diff --git a/src/client/telemetry/constants.ts b/src/client/telemetry/constants.ts index 4a895ab8a9ff..d30a2683562c 100644 --- a/src/client/telemetry/constants.ts +++ b/src/client/telemetry/constants.ts @@ -71,6 +71,7 @@ export enum EventName { LANGUAGE_SERVER_READY = 'LANGUAGE_SERVER.READY', LANGUAGE_SERVER_TELEMETRY = 'LANGUAGE_SERVER.EVENT', LANGUAGE_SERVER_REQUEST = 'LANGUAGE_SERVER.REQUEST', + LANGUAGE_SERVER_RESTART = 'LANGUAGE_SERVER.RESTART', TERMINAL_CREATE = 'TERMINAL.CREATE', ACTIVATE_ENV_IN_CURRENT_TERMINAL = 'ACTIVATE_ENV_IN_CURRENT_TERMINAL', diff --git a/src/client/telemetry/index.ts b/src/client/telemetry/index.ts index 41cf311c4d44..d9091cced48f 100644 --- a/src/client/telemetry/index.ts +++ b/src/client/telemetry/index.ts @@ -1475,6 +1475,17 @@ export interface IEventNamePropertyMapping { } */ [EventName.LANGUAGE_SERVER_REQUEST]: unknown; + /** + * Telemetry send when Language Server is restarted. + */ + /* __GDPR__ + "language_server_restart" : { + "reason" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karthiknadig" } + } + */ + [EventName.LANGUAGE_SERVER_RESTART]: { + reason: 'command' | 'settings' | 'notebooksExperiment'; + }; /** * Telemetry event sent when Jedi Language Server is started for workspace (workspace folder in case of multi-root) */