Skip to content

Commit ec0fb4f

Browse files
authored
Update start-up telemetry for Jedi LSP (#15419) (#15571)
1 parent ba1dc7d commit ec0fb4f

File tree

5 files changed

+40
-23
lines changed

5 files changed

+40
-23
lines changed

src/client/activation/activationService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export class LanguageServerExtensionActivationService
279279
outputLine = LanguageService.startingNone();
280280
break;
281281
default:
282-
throw new Error('Unknown langauge server type in activator.');
282+
throw new Error('Unknown language server type in activator.');
283283
}
284284
this.output.appendLine(outputLine);
285285
}

src/client/activation/jedi/languageServerProxy.ts

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import {
1313

1414
import { DeprecatePythonPath } from '../../common/experiments/groups';
1515
import { traceDecorators, traceError } from '../../common/logger';
16-
import { IConfigurationService, IExperimentsManager, IInterpreterPathService, Resource } from '../../common/types';
16+
import { IExperimentsManager, IInterpreterPathService, Resource } from '../../common/types';
1717
import { createDeferred, Deferred, sleep } from '../../common/utils/async';
1818
import { swallowExceptions } from '../../common/utils/decorators';
1919
import { noop } from '../../common/utils/misc';
2020
import { LanguageServerSymbolProvider } from '../../providers/symbolProvider';
2121
import { PythonEnvironment } from '../../pythonEnvironments/info';
22-
import { captureTelemetry, sendTelemetryEvent } from '../../telemetry';
22+
import { captureTelemetry } from '../../telemetry';
2323
import { EventName } from '../../telemetry/constants';
2424
import { ITestManagementService } from '../../testing/types';
2525
import { FileBasedCancellationStrategy } from '../common/cancellationUtils';
@@ -44,7 +44,6 @@ export class JediLanguageServerProxy implements ILanguageServerProxy {
4444
constructor(
4545
@inject(ILanguageClientFactory) private readonly factory: ILanguageClientFactory,
4646
@inject(ITestManagementService) private readonly testManager: ITestManagementService,
47-
@inject(IConfigurationService) private readonly configurationService: IConfigurationService,
4847
@inject(IExperimentsManager) private readonly experiments: IExperimentsManager,
4948
@inject(IInterpreterPathService) private readonly interpreterPathService: IInterpreterPathService,
5049
) {
@@ -81,7 +80,7 @@ export class JediLanguageServerProxy implements ILanguageServerProxy {
8180

8281
@traceDecorators.error('Failed to start language server')
8382
@captureTelemetry(
84-
EventName.LANGUAGE_SERVER_ENABLED,
83+
EventName.JEDI_LANGUAGE_SERVER_ENABLED,
8584
undefined,
8685
true,
8786
undefined,
@@ -107,7 +106,7 @@ export class JediLanguageServerProxy implements ILanguageServerProxy {
107106
// late the server may have already sent a message (which leads to failures). Register
108107
// these on the state change to running to ensure they are ready soon enough.
109108
if (e.newState === State.Running) {
110-
this.registerHandlers(resource);
109+
this.registerHandlers();
111110
}
112111
});
113112

@@ -131,7 +130,7 @@ export class JediLanguageServerProxy implements ILanguageServerProxy {
131130
}
132131

133132
@captureTelemetry(
134-
EventName.LANGUAGE_SERVER_READY,
133+
EventName.JEDI_LANGUAGE_SERVER_READY,
135134
undefined,
136135
true,
137136
undefined,
@@ -155,7 +154,7 @@ export class JediLanguageServerProxy implements ILanguageServerProxy {
155154
await this.testManager.activate(new LanguageServerSymbolProvider(this.languageClient));
156155
}
157156

158-
private registerHandlers(resource: Resource) {
157+
private registerHandlers() {
159158
if (this.disposed) {
160159
// Check if it got disposed in the interim.
161160
return;
@@ -167,7 +166,7 @@ export class JediLanguageServerProxy implements ILanguageServerProxy {
167166
if (this.experiments.inExperiment(DeprecatePythonPath.experiment)) {
168167
this.disposables.push(
169168
this.interpreterPathService.onDidChange(() => {
170-
// Manually send didChangeConfiguration in order to get the server to requery
169+
// Manually send didChangeConfiguration in order to get the server to re-query
171170
// the workspace configurations (to then pick up pythonPath set in the middleware).
172171
// This is needed as interpreter changes via the interpreter path service happen
173172
// outside of VS Code's settings (which would mean VS Code sends the config updates itself).
@@ -177,18 +176,5 @@ export class JediLanguageServerProxy implements ILanguageServerProxy {
177176
}),
178177
);
179178
}
180-
181-
const settings = this.configurationService.getSettings(resource);
182-
if (settings.downloadLanguageServer) {
183-
this.languageClient!.onTelemetry((telemetryEvent) => {
184-
const eventName = telemetryEvent.EventName || EventName.LANGUAGE_SERVER_TELEMETRY;
185-
const formattedProperties = {
186-
...telemetryEvent.Properties,
187-
// Replace all slashes in the method name so it doesn't get scrubbed by vscode-extension-telemetry.
188-
method: telemetryEvent.Properties.method?.replace(/\//g, '.'),
189-
};
190-
sendTelemetryEvent(eventName, telemetryEvent.Measurements, formattedProperties);
191-
});
192-
}
193179
}
194180
}

src/client/activation/jedi/manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class JediLanguageServerManager implements ILanguageServerManager {
121121
}
122122

123123
@captureTelemetry(
124-
EventName.LANGUAGE_SERVER_STARTUP,
124+
EventName.JEDI_LANGUAGE_SERVER_STARTUP,
125125
undefined,
126126
true,
127127
undefined,

src/client/telemetry/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ export enum EventName {
120120
HASHED_PACKAGE_PERF = 'HASHED_PACKAGE_PERF',
121121

122122
JEDI_MEMORY = 'JEDI_MEMORY',
123+
JEDI_LANGUAGE_SERVER_ENABLED = 'JEDI_LANGUAGE_SERVER.ENABLED',
124+
JEDI_LANGUAGE_SERVER_STARTUP = 'JEDI_LANGUAGE_SERVER.STARTUP',
125+
JEDI_LANGUAGE_SERVER_READY = 'JEDI_LANGUAGE_SERVER.READY',
126+
JEDI_LANGUAGE_SERVER_TELEMETRY = 'JEDI_LANGUAGE_SERVER.EVENT',
127+
JEDI_LANGUAGE_SERVER_REQUEST = 'JEDI_LANGUAGE_SERVER.REQUEST',
123128

124129
TENSORBOARD_SESSION_LAUNCH = 'TENSORBOARD.SESSION_LAUNCH',
125130
TENSORBOARD_SESSION_DURATION = 'TENSORBOARD.SESSION_DURATION',

src/client/telemetry/index.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,32 @@ export interface IEventNamePropertyMapping {
13751375
*/
13761376
userAction: string;
13771377
};
1378+
/**
1379+
* Telemetry event sent when Jedi Language Server is started for workspace (workspace folder in case of multi-root)
1380+
*/
1381+
[EventName.JEDI_LANGUAGE_SERVER_ENABLED]: {
1382+
lsVersion?: string;
1383+
};
1384+
/**
1385+
* Telemetry event sent when Jedi Language Server server is ready to receive messages
1386+
*/
1387+
[EventName.JEDI_LANGUAGE_SERVER_READY]: {
1388+
lsVersion?: string;
1389+
};
1390+
/**
1391+
* Telemetry event sent when starting Node.js server
1392+
*/
1393+
[EventName.JEDI_LANGUAGE_SERVER_STARTUP]: {
1394+
lsVersion?: string;
1395+
};
1396+
/**
1397+
* Telemetry sent from Node.js server (details of telemetry sent can be provided by LS team)
1398+
*/
1399+
[EventName.JEDI_LANGUAGE_SERVER_TELEMETRY]: unknown;
1400+
/**
1401+
* Telemetry sent when the client makes a request to the Node.js server
1402+
*/
1403+
[EventName.JEDI_LANGUAGE_SERVER_REQUEST]: unknown;
13781404
/**
13791405
* Telemetry captured for enabling reload.
13801406
*/

0 commit comments

Comments
 (0)