Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better logs when interpreter does not match kernel #5510

Merged
merged 1 commit into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the existing infrastructure we can tell:

  • If its a notebook vs interactive window
  • If its custom vs native notebook
  • If user ran the cell vs auto start
    All three are crucial and this wasn't easy to get with the previous event.

Removing the old item, once we add this, we can deprecate the old event.

} 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