fix: cache static telemetry properties to prevent validation errors when provider is disposed #10741
+92
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR attempts to address Issue #10737.
Problem
When ClineProvider is disposed (e.g., when the webview tab is closed), the WeakRef in TelemetryClient returns undefined, causing required telemetry properties (
appName,appVersion,vscodeVersion,platform,editorName,language,mode) to be undefined. This results in telemetry validation errors like:Solution
This fix:
BaseTelemetryClientwhensetProvider()is calledChanges
cachedStaticPropertiesfield and logic to cache/use static propertiesFeedback and guidance are welcome.
Important
Caches static telemetry properties in
BaseTelemetryClientto prevent validation errors when provider is disposed, ensuring telemetry events remain valid.BaseTelemetryClientwhensetProvider()is called.WeakRefreturns undefined, ensuring required telemetry fields are present.cachedStaticPropertiestoBaseTelemetryClientinTelemetryClient.ts.getEventProperties()to use cached properties if provider is unavailable.TelemetryClient.test.tsfor caching behavior and provider disposal scenarios.This description was created by
for 49ad8ae. You can customize this summary. It will automatically update as commits are pushed.