-
Notifications
You must be signed in to change notification settings - Fork 323
Switch to VS Code's telemetry classes #4377
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
Comments
@DanTup since our Should we keep the Analytics class or have just the TelemetryLogger? |
Those methods are just helpers for stronger typing from the calling code. They all call an So I think the Then the By keeping the |
Got it, thanks! |
There is a problem with this approach, the TelemetrySender class forces us to either repeat the send method on both methods or define it outside (globally) which is dirty. OR define it in the class and call the class from TelemetrySender. What do you think? |
@aitor-gomila I'm not sure exactly which method you mean. The idea I had (but I haven't tried it out) was something like this:
Does this seem feasible? |
Yes, this is what I was thinking. The problem is |
We could still have a private method instead However, we don't actually use errors anymore. The only code that calls to log errors is in the legacy analysis server protocol, which is hardly used for anyone. I would just leave |
Got it. Appreciate the clarification :) Tried to create a private send method inside TelemetrySender but the compiler complained. I actually think not logging errors is not a bad idea, but if we ever need them, we'll need to think about this issue, or just add an additional event type for errors. The only difference being how VSCode displays that. |
Odd. I tested it here and this seemed ok: class Foo implements TelemetrySender {
public sendEventData(eventName: string, data?: Record<string, any> | undefined): void {
throw new Error("Method not implemented.");
}
public sendErrorData(error: Error, data?: Record<string, any> | undefined): void {
throw new Error("Method not implemented.");
}
private foo() {
}
}
const sender = new Foo();
const logger = env.createTelemetryLogger(sender); If you have issues though, let me know (although it's probably not important now if we just put the sending in
Yeah, this can be something to consider for later. Right now we're not really capturing them so we shouldn't hold up migrating to the new APIs to change that. |
Are you typechecking that code? Need to check that again. |
Yep, I initially had errors because I was trying to |
That's it then. It makes a lot of sense now. |
Done via #4457 :-) |
https://code.visualstudio.com/updates/v1_75#_telemetry
This simplifies things be handling opt-in/opt-out and ensuring no user info leaks into the data. Adopting it requires bumping he required VS Code version though.
The text was updated successfully, but these errors were encountered: