You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The existing APIs help you to get the job done but offer little quality of life, aren't always easy to use, and lack hooks that we would like for transparency and cleansing. Our goal is to make it easy for extensions to do the right thing and to be transparent to our user what's happening.
Below is an alternative API that is around a TelemetryLogger and TelemetryAppender. The appender is what does the actual data collecting but it should be used through a logger. With that "indirection" we can do many nice things:
we can do extra PII cleansing for extensions, e.g remove everything that looks like path-name, URI, user-name etc
we can enable/disable telemetry per extension
we echo everything that is logged to the telemetry output channel
we check enablements: logger.logUsage() -> setting say NO ⛔ -> we don't call appender
declare module 'vscode'{exportinterfaceTelemetryLogger{readonlyonDidChangeEnableStates: Event<TelemetryLogger>;readonlyisUsageEnabled: boolean;readonlyisErrorsEnabled: boolean;// calls TelemetryAppender#logUsage iff usage telemetry is enabled, echos data to output channel// called by extensionlogUsage(...args: any[]): void;// calls TelemetryAppender#logError iff error telemetry is enabled, echos data to output channel// called by extension// ALSO called by VS Code when the owning extension throws, e.g provider or command errorslogError(err: Error): void;}exportinterfaceTelemetryAppender{logUsage(...args: any[]): void;logError(err: Error): void;}exportnamespaceenv{// BYOTAexportfunctioncreateTelemetryLogger(appender: TelemetryAppender): TelemetryLogger;}}
In todays API there are some symbols that help extensions with telemetry, e.g machineId, sessionId, and most importantly isTelemetryEnabled. These are used by our telemetry module and by others.
The existing APIs help you to get the job done but offer little quality of life, aren't always easy to use, and lack hooks that we would like for transparency and cleansing. Our goal is to make it easy for extensions to do the right thing and to be transparent to our user what's happening.
Below is an alternative API that is around a
TelemetryLoggerandTelemetryAppender. The appender is what does the actual data collecting but it should be used through a logger. With that "indirection" we can do many nice things:logger.logUsage()-> setting say NO ⛔ -> we don't call appenderlogErroron provider-errors and unhandled extension errors (superseeding Allow extensions to provide a global error handler for errors in extension code #45264)The vscode-extension-telemetry-module would become an instance of a telemetry appender.