diff --git a/src/lsptoolshost/roslynLanguageServer.ts b/src/lsptoolshost/roslynLanguageServer.ts index 9e7adf6b2..ff34a73a4 100644 --- a/src/lsptoolshost/roslynLanguageServer.ts +++ b/src/lsptoolshost/roslynLanguageServer.ts @@ -76,6 +76,7 @@ import { } from '../shared/observers/utils/showMessage'; import { registerSourceGeneratedFilesContentProvider } from './sourceGeneratedFilesContentProvider'; import { registerMiscellaneousFileNotifier } from './miscellaneousFileNotifier'; +import { TelemetryEventNames } from '../shared/telemetryEventNames'; let _channel: vscode.LogOutputChannel; let _traceChannel: vscode.OutputChannel; @@ -574,12 +575,13 @@ export class RoslynLanguageServer { telemetryReporter: TelemetryReporter, additionalExtensionPaths: string[] ): Promise { + telemetryReporter.sendTelemetryEvent(TelemetryEventNames.ClientServerStart); const serverPath = getServerPath(platformInfo); const dotnetInfo = await hostExecutableResolver.getHostExecutableInfo(); const dotnetExecutablePath = dotnetInfo.path; - _channel.info('Dotnet path: ' + dotnetExecutablePath); + telemetryReporter.sendTelemetryEvent(TelemetryEventNames.AcquiredRuntime); let args: string[] = []; @@ -684,6 +686,8 @@ export class RoslynLanguageServer { childProcess = cp.spawn(serverPath, args, cpOptions); } + telemetryReporter.sendTelemetryEvent(TelemetryEventNames.LaunchedServer); + // Record the stdout and stderr streams from the server process. childProcess.stdout.on('data', (data: { toString: (arg0: any) => any }) => { const result: string = isString(data) ? data : data.toString(RoslynLanguageServer.encoding); @@ -756,6 +760,8 @@ export class RoslynLanguageServer { throw new Error('Timeout. Client cound not connect to server via named pipe'); } + telemetryReporter.sendTelemetryEvent(TelemetryEventNames.ClientConnected); + return { reader: new SocketMessageReader(socket, RoslynLanguageServer.encoding), writer: new SocketMessageWriter(socket, RoslynLanguageServer.encoding), @@ -1072,6 +1078,8 @@ export async function activateRoslynLanguageServer( // The trace channel verbosity is controlled by the _channel verbosity. _traceChannel = vscode.window.createOutputChannel('C# LSP Trace Logs'); + reporter.sendTelemetryEvent(TelemetryEventNames.ClientInitialize); + const hostExecutableResolver = new DotnetRuntimeExtensionResolver( platformInfo, getServerPath, diff --git a/src/main.ts b/src/main.ts index 1f7eaa7f8..1a83503fa 100644 --- a/src/main.ts +++ b/src/main.ts @@ -41,6 +41,7 @@ import { debugSessionTracker } from './coreclrDebug/provisionalDebugSessionTrack import { getComponentFolder } from './lsptoolshost/builtInComponents'; import { activateOmniSharpLanguageServer, ActivationResult } from './omnisharp/omnisharpLanguageServer'; import { ActionOption, showErrorMessage } from './shared/observers/utils/showMessage'; +import { TelemetryEventNames } from './shared/telemetryEventNames'; export async function activate( context: vscode.ExtensionContext @@ -218,7 +219,7 @@ export async function activate( const activationProperties: { [key: string]: string } = { serverKind: useOmnisharpServer ? 'OmniSharp' : 'Roslyn', }; - reporter.sendTelemetryEvent('CSharpActivated', activationProperties); + reporter.sendTelemetryEvent(TelemetryEventNames.CSharpActivated, activationProperties); if (!useOmnisharpServer) { debugSessionTracker.initializeDebugSessionHandlers(context); diff --git a/src/shared/telemetryEventNames.ts b/src/shared/telemetryEventNames.ts new file mode 100644 index 000000000..88b065b60 --- /dev/null +++ b/src/shared/telemetryEventNames.ts @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/** + * Defines all telemetry event names to ensure we do not have overlapping events. + */ +export enum TelemetryEventNames { + // Common extension events + CSharpActivated = 'CSharpActivated', + + // Events related to the roslyn language server. + ClientInitialize = 'roslyn/clientInitialize', + ClientServerStart = 'roslyn/clientServerInitialize', + AcquiredRuntime = 'roslyn/acquiredRuntime', + LaunchedServer = 'roslyn/launchedServer', + ClientConnected = 'roslyn/clientConnected', +}