Skip to content

Commit a16337b

Browse files
authored
Clean up telemetry (microsoft#6500)
1 parent aebadfb commit a16337b

File tree

9 files changed

+79
-50
lines changed

9 files changed

+79
-50
lines changed

news/3 Code Health/6451.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Consolidate telemetry.

package-lock.json

Lines changed: 68 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client/activation/activationService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class LanguageServerExtensionActivationService implements IExtensionActiv
5959
const diagnostic = await this.lsNotSupportedDiagnosticService.diagnose(undefined);
6060
this.lsNotSupportedDiagnosticService.handle(diagnostic).ignoreErrors();
6161
if (diagnostic.length) {
62-
sendTelemetryEvent(EventName.PYTHON_LANGUAGE_SERVER_PLATFORM_NOT_SUPPORTED);
62+
sendTelemetryEvent(EventName.PYTHON_LANGUAGE_SERVER_PLATFORM_SUPPORTED, undefined, { supported: false });
6363
jedi = true;
6464
}
6565
} else {

src/client/activation/languageServer/languageServerCompatibilityService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class LanguageServerCompatibilityService implements ILanguageServerCompat
1616
public async isSupported(): Promise<boolean> {
1717
try {
1818
const supported = await this.dotnetCompatibility.isSupported();
19-
sendTelemetryEvent(EventName.PYTHON_LANGUAGE_SERVER_PLATFORM_SUPPORTED, undefined, { supported });
19+
sendTelemetryEvent(EventName.PYTHON_LANGUAGE_SERVER_PLATFORM_SUPPORTED, undefined, { supported: supported });
2020
return supported;
2121
} catch (ex) {
2222
traceError('Unable to determine whether LS is supported', ex);

src/client/telemetry/constants.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,15 @@ export enum EventName {
4848
UNITTEST_CONFIGURE = 'UNITTEST.CONFIGURE',
4949
UNITTEST_CONFIGURING = 'UNITTEST.CONFIGURING',
5050
UNITTEST_VIEW_OUTPUT = 'UNITTEST.VIEW_OUTPUT',
51-
UNITTEST_NAVIGATE_TEST_FILE = 'UNITTEST.NAVIGATE.TEST_FILE',
52-
UNITTEST_NAVIGATE_TEST_FUNCTION = 'UNITTEST.NAVIGATE.TEST_FUNCTION',
53-
UNITTEST_NAVIGATE_TEST_SUITE = 'UNITTEST.NAVIGATE.TEST_SUITE',
51+
UNITTEST_NAVIGATE = 'UNITTEST.NAVIGATE',
5452
UNITTEST_EXPLORER_WORK_SPACE_COUNT = 'UNITTEST.TEST_EXPLORER.WORK_SPACE_COUNT',
5553
PYTHON_LANGUAGE_SERVER_SWITCHED = 'PYTHON_LANGUAGE_SERVER.SWITCHED',
56-
PYTHON_LANGUAGE_SERVER_ANALYSISTIME = 'PYTHON_LANGUAGE_SERVER.ANALYSIS_TIME',
5754
PYTHON_LANGUAGE_SERVER_ENABLED = 'PYTHON_LANGUAGE_SERVER.ENABLED',
5855
PYTHON_LANGUAGE_SERVER_EXTRACTED = 'PYTHON_LANGUAGE_SERVER.EXTRACTED',
5956
PYTHON_LANGUAGE_SERVER_DOWNLOADED = 'PYTHON_LANGUAGE_SERVER.DOWNLOADED',
6057
PYTHON_LANGUAGE_SERVER_ERROR = 'PYTHON_LANGUAGE_SERVER.ERROR',
6158
PYTHON_LANGUAGE_SERVER_STARTUP = 'PYTHON_LANGUAGE_SERVER.STARTUP',
6259
PYTHON_LANGUAGE_SERVER_READY = 'PYTHON_LANGUAGE_SERVER.READY',
63-
PYTHON_LANGUAGE_SERVER_PLATFORM_NOT_SUPPORTED = 'PYTHON_LANGUAGE_SERVER.PLATFORM_NOT_SUPPORTED',
6460
PYTHON_LANGUAGE_SERVER_PLATFORM_SUPPORTED = 'PYTHON_LANGUAGE_SERVER.PLATFORM_SUPPORTED',
6561
PYTHON_LANGUAGE_SERVER_TELEMETRY = 'PYTHON_LANGUAGE_SERVER.EVENT',
6662
PYTHON_EXPERIMENTS = 'PYTHON_EXPERIMENTS',

src/client/telemetry/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,11 @@ export interface IEventNamePropertyMapping {
299299
[EventName.PYTHON_INTERPRETER_DISCOVERY]: InterpreterDiscovery;
300300
[EventName.PYTHON_INTERPRETER_ACTIVATE_ENVIRONMENT_PROMPT]: { selection: 'Yes' | 'No' | 'Ignore' | undefined };
301301
[EventName.PYTHON_LANGUAGE_SERVER_SWITCHED]: { change: 'Switch to Jedi from LS' | 'Switch to LS from Jedi' };
302-
[EventName.PYTHON_LANGUAGE_SERVER_ANALYSISTIME]: { success: boolean };
303302
[EventName.PYTHON_LANGUAGE_SERVER_DOWNLOADED]: LanguageServerVersionTelemetry;
304303
[EventName.PYTHON_LANGUAGE_SERVER_ENABLED]: never | undefined;
305304
[EventName.PYTHON_LANGUAGE_SERVER_ERROR]: LanguageServerErrorTelemetry;
306305
[EventName.PYTHON_LANGUAGE_SERVER_EXTRACTED]: LanguageServerVersionTelemetry;
307306
[EventName.PYTHON_LANGUAGE_SERVER_LIST_BLOB_STORE_PACKAGES]: never | undefined;
308-
[EventName.PYTHON_LANGUAGE_SERVER_PLATFORM_NOT_SUPPORTED]: never | undefined;
309307
[EventName.PYTHON_LANGUAGE_SERVER_PLATFORM_SUPPORTED]: LanguageServePlatformSupported;
310308
[EventName.PYTHON_LANGUAGE_SERVER_READY]: never | undefined;
311309
[EventName.PYTHON_LANGUAGE_SERVER_STARTUP]: never | undefined;
@@ -325,6 +323,8 @@ export interface IEventNamePropertyMapping {
325323
[EventName.TERMINAL_CREATE]: TerminalTelemetry;
326324
[EventName.UNITTEST_DISCOVER]: TestDiscoverytTelemetry;
327325
[EventName.UNITTEST_DISCOVER_WITH_PYCODE]: never | undefined;
326+
[EventName.UNITTEST_NAVIGATE]: { byFile?: boolean; byFunction?: boolean; bySuite?: boolean; focus_code?: boolean };
327+
[EventName.UNITTEST_EXPLORER_WORK_SPACE_COUNT]: { count: number };
328328
[EventName.UNITTEST_RUN]: TestRunTelemetry;
329329
[EventName.UNITTEST_STOP]: never | undefined;
330330
[EventName.UNITTEST_DISABLE]: never | undefined;
@@ -403,10 +403,6 @@ export interface IEventNamePropertyMapping {
403403
[Telemetry.WebviewMonacoStyleUpdate]: never | undefined;
404404
[Telemetry.WebviewStartup]: { type: string };
405405
[Telemetry.WebviewStyleUpdate]: never | undefined;
406-
[EventName.UNITTEST_NAVIGATE_TEST_FILE]: never | undefined;
407-
[EventName.UNITTEST_NAVIGATE_TEST_FUNCTION]: { focus_code: boolean };
408-
[EventName.UNITTEST_NAVIGATE_TEST_SUITE]: { focus_code: boolean };
409-
[EventName.UNITTEST_EXPLORER_WORK_SPACE_COUNT]: { count: number };
410406
/*
411407
Telemetry event sent with details of Jedi Memory usage.
412408
memory - Memory usage of Process in kb.

src/client/testing/navigation/fileNavigator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { ITestCodeNavigator, ITestNavigatorHelper } from './types';
1515
export class TestFileCodeNavigator implements ITestCodeNavigator {
1616
constructor(@inject(ITestNavigatorHelper) private readonly helper: ITestNavigatorHelper) { }
1717
@swallowExceptions('Navigate to test file')
18-
@captureTelemetry(EventName.UNITTEST_NAVIGATE_TEST_FILE, undefined, true)
18+
@captureTelemetry(EventName.UNITTEST_NAVIGATE, { byFile: true })
1919
public async navigateTo(_: Uri, item: TestFile, __: boolean): Promise<void> {
2020
await this.helper.openFile(Uri.file(item.fullPath));
2121
}

src/client/testing/navigation/functionNavigator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export class TestFunctionCodeNavigator implements ITestCodeNavigator {
2222
@inject(ITestCollectionStorageService) private readonly storage: ITestCollectionStorageService
2323
) { }
2424
@swallowExceptions('Navigate to test function')
25-
@captureTelemetry(EventName.UNITTEST_NAVIGATE_TEST_FUNCTION, undefined, true)
25+
@captureTelemetry(EventName.UNITTEST_NAVIGATE, { byFunction: true }, true) // To measure execution time.
2626
public async navigateTo(resource: Uri, fn: TestFunction, focus: boolean = true): Promise<void> {
27-
sendTelemetryEvent(EventName.UNITTEST_NAVIGATE_TEST_FUNCTION, undefined, { focus_code: focus });
27+
sendTelemetryEvent(EventName.UNITTEST_NAVIGATE, undefined, { focus_code: focus, byFunction: true });
2828
if (this.cancellationToken) {
2929
this.cancellationToken.cancel();
3030
}

src/client/testing/navigation/suiteNavigator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export class TestSuiteCodeNavigator implements ITestCodeNavigator {
2222
@inject(ITestCollectionStorageService) private readonly storage: ITestCollectionStorageService
2323
) { }
2424
@swallowExceptions('Navigate to test suite')
25-
@captureTelemetry(EventName.UNITTEST_NAVIGATE_TEST_SUITE, undefined, true)
25+
@captureTelemetry(EventName.UNITTEST_NAVIGATE, { bySuite: true }, true) // For measuring execution time.
2626
public async navigateTo(resource: Uri, suite: TestSuite, focus: boolean = true): Promise<void> {
27-
sendTelemetryEvent(EventName.UNITTEST_NAVIGATE_TEST_SUITE, undefined, { focus_code: focus });
27+
sendTelemetryEvent(EventName.UNITTEST_NAVIGATE, undefined, { focus_code: focus, bySuite: true });
2828
if (this.cancellationToken) {
2929
this.cancellationToken.cancel();
3030
}

0 commit comments

Comments
 (0)