Skip to content

Commit

Permalink
Better logs when interpreter does not match kernel (#5510)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored Apr 14, 2021
1 parent f6e1d06 commit 967709c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/3 Code Health/5509.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improvements to telemetry used to check if we're not starting the right interpreter (for a Python kernel).
3 changes: 3 additions & 0 deletions src/client/datascience/jupyter/kernels/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import { traceInfo, traceInfoIf } from '../../../common/logger';
import { getInterpreterHash } from '../../../pythonEnvironments/info/interpreter';
import { getTelemetrySafeVersion } from '../../../telemetry/helpers';
import { IS_CI_SERVER } from '../../../../test/ciConstants';
import { trackKernelResourceInformation } from '../../telemetry/telemetry';
import { Uri } from 'vscode';

// Helper functions for dealing with kernels and kernelspecs

Expand Down Expand Up @@ -468,6 +470,7 @@ export async function sendTelemetryForPythonKernelExecutable(
match: match ? 'true' : 'false',
kernelConnectionType: kernelConnection.kind
});
trackKernelResourceInformation(Uri.file(file), { interpreterMatchesKernel: match });
} catch (ex) {
// Noop.
}
Expand Down
7 changes: 7 additions & 0 deletions src/client/datascience/telemetry/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import { InterpreterPackages } from './interpreterPackages';
import { populateTelemetryWithErrorInfo } from '../../common/errors';
import { createDeferred } from '../../common/utils/async';

/**
* This information is sent with each telemetry event.
*/
type ContextualTelemetryProps = {
kernelConnection: KernelConnectionMetadata;
/**
Expand All @@ -38,6 +41,10 @@ type ContextualTelemetryProps = {
kernelSpecCount: number; // Total number of kernel specs in list of kernels.
kernelInterpreterCount: number; // Total number of interpreters in list of kernels
kernelLiveCount: number; // Total number of live kernels in list of kernels.
/**
* When we start local Python kernels, this property indicates whether the interpreter matches the kernel. If not this means we've started the wrong interpreter or the mapping is wrong.
*/
interpreterMatchesKernel: boolean;
};

type Context = {
Expand Down

0 comments on commit 967709c

Please sign in to comment.