-
Notifications
You must be signed in to change notification settings - Fork 202
Add the CLI version to telemetry events #2307
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
Conversation
This adds the CLI version to telemetry command-usage events. Note that the CLI server is created after the telemetry listener is created. The first few telemetry events may have a "not-set" value for the CLI version.
9c99553
to
d6b3e51
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this, this will definitely be useful!
I'm somewhat concerned about the performance impact this will have on sending commands. If there is no version available, this will spawn a process to get the CLI version, which might delay the telemetry and possibly skip sending the telemetry if VS Code gets closed early.
I also think the CLI version would be useful on other telemetry events (especially errors). I think it would be good if we could use a addTelemetryProcessor
to add the CLI version tag to every telemetry event we send. The telemetry processor is not async
, but we could use the cached CLI version here. That would also solve my concern about performance. We should already always be retrieving the version in the CLI server (since it's also used by CLI version constraints and the status bar), so I think this would be a very viable option for adding the CLI version to all telemetry events without the possibility of spawning a process on every telemetry event.
I agree with Koen's points. Calculating the CLI version while handling the telemetry event doesn't seem great, both in terms of performance and the chance of errors happening and stopping us sending telemetry. Could we set the CLI version once, and then maybe update it if the CLI changes? I also agree it would be nice to have this on all events, like how we include |
Thanks for the feedback. I will change my approach. I'll add a callback to the CliServer that gets invoked whenever the CLI version changes. There will still be a time at startup when the cli version is not known since the telemetry listener is instantiated before the cli server (sometimes this takes a while). I can also add the cli version to all telemetry events. |
Set the CLI version in the telemetry listener whenever the version changes. A few things to note here: 1. In `CliServer::getVersion()`, avoid calling `supportsPerQueryEvalLog` directly. This avoids a recursive call to `CliServer::getVersion()`. Currently, it's always safe to do this, but I thought that it would be good to avoid recursion here in case we change things in the future. 2. Now, we are sending the CLI version with all telemetry events.
I think I addressed all the comments. |
Not sure why I'm getting a failing test: https://github.com/github/vscode-codeql/actions/runs/4693003381/jobs/8320617631#step:9:69 It doesn't seem related to my changes, but it is repeatable in CI. Looks like this job on main failed in a similar way: https://github.com/github/vscode-codeql/actions/runs/4690867136/jobs/8314564124 |
Maybe updating the branch will help. |
Nope. |
I'd guess we have some tests that are very close to the timeout value, and they've just tipped over recently 😢 |
We have an internal issue about tests timing out and I've mentioned this there. Either we should look at making the tests faster or raising the timeout value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for addressing our concerns!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too
Here's my analysis: The first error was indeed a timeout error:
The tests re-ran and somewhere during the retry, the original query finally completed, but the callback failed since the connection had already been disposed. So, I think increasing the timeout will work, and we should also figure out a way to properly cancel a query in the teardown. Also, I found another error where I will put a fix in for this and bump the timeouts. Both will be in a separate PR. |
I attempt to address this and some related concerns here: #2331 |
This adds the CLI version to telemetry command-usage events.
Note that the CLI server is created after the telemetry listener is created. The first few telemetry events may have a "not-set" value for the CLI version.
Checklist
ready-for-doc-review
label there.