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

Fix telemetry for VS scenarios #3414

Merged
merged 1 commit into from
Jan 13, 2024

Conversation

shyamnamboodiripad
Copy link
Contributor

Don't disable telemetry if the DOTNET_INTERACTIVE_SKIP_FIRST_TIME_EXPERIENCE environment variable is set and the .dotnetInteractiveFirstUseSentinel file is missing.

We already had the correct checks in place (inside CommandLineParser.Create()) to disable sentinel file creation when the environment variable is set. But when initializing TelemetrySender._enabled, we were only checking for the presence of the sentinel file and were missing the environment variable check. This meant that if the environment variable is set, then TelemetrySender._enabled would be initialized to false for the first launch of a particular version of the tool. And it would remain false during subsequent launches of the same tool version (since the aforementioned check inside CommandLineParser.Create() would ensure than a sentinel file is never created when the environment variable is set).

The environment variable is always set when the tool is launched via StdIoKernelConnector which is used in the VS scenario. The above bug therefore meant that we would fail to send any telemetry when the tool is launched by VS.

However, the environment variable is not set when the tool is launched by the polyglot notebooks VS Code extension. This led to some very confusing behavior where we would occasionally see some telemetry for VS when some user happens to be running both VS and polyglot notebooks on the same machine, and when the versions of the tool launched by VS and polyglot notebooks extension happen to align exactly 😄 In such cases, the first polyglot notebooks launch of the tool on the machine would create a sentinel file on disk for the corresponding tool version thereby unblocking telemetry for subsequent VS launches of the same tool version.

…PERIENCE` environment variable is set and the `dotnetInteractiveFirstUseSentinel` file is missing.

We already had the correct checks in place (inside `CommandLineParser.Create()`) to disable sentinel file creation when the environment variable is set. But when initializing `TelemetrySender._enabled`, we were only checking for the presence of the sentinel file and were missing the environment variable check. This meant that if the environment variable is set, then `TelemetrySender._enabled` would be initialized to `false` for the first launch of a particular version of the tool. And it would remain `false` during subsequent launches of the same tool version (since the aforementioned check inside `CommandLineParser.Create()` would ensure than a sentinel file is never created when the environment variable is set).

The environment variable is always set when the tool is launched via `StdIoKernelConnector` which is used in the VS scenario. The above bug therefore meant that we would fail to send any telemetry when the tool is launched by VS.

However, the environment variable is not set when the tool is launched by the polyglot notebooks VS Code extension. This led to some very confusing behavior where we would occasionally see some telemetry for VS when some user happens to be running both VS and polyglot notebooks on the same machine, *and when the versions of the tool launched by VS and polyglot notebooks extension happen to align exactly* 😄  In such cases, the first polyglot notebooks launch of the tool on the machine would create a sentinel file on disk for the corresponding tool version thereby unblocking telemetry for subsequent VS launches of the same tool version.
@shyamnamboodiripad shyamnamboodiripad merged commit 98de3d1 into dotnet:main Jan 13, 2024
4 checks passed
@shyamnamboodiripad shyamnamboodiripad deleted the fixvstelemetry branch January 14, 2024 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants