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
telemetry(auth): Enable load telemetry for Toolkit login webview (aws#8100)
## Problem
The Toolkit login webview throws an error when calling `setUiReady()`
because `loadMetadata` is undefined:
```
[error] webviewId="aws.toolkit.AmazonCommonAuth": Error: Webview error
-> Error: Webview backend command failed: "setUiReady()"
-> TypeError: Cannot read properties of undefined (reading 'start')
```
This occurs because `supportsLoadTelemetry` defaults to false in the
base `VueWebview` class, preventing the initialization of `loadMetadata`
during webview setup. Without `loadMetadata`, the webview cannot track
load timing or emit load telemetry.
## Solution
Added one line to enable load telemetry in `ToolkitLoginWebview`.
This flag was originally introduced in
[e7b7307](aws@e7b7307)
to track Amazon Q webview load times and failures. We're now extending
this functionality to the Toolkit login webview for consistent telemetry
across both implementations.
### Before fix:
<img width="2108" height="1109" alt="before-toolkit-auth-webview-error"
src="https://github.com/user-attachments/assets/e53fb12b-6966-45ca-bee5-645e48a09cd4"
/>
Toolkit login webview error showing loadMetadata undefined. This occurs
because `supportsLoadTelemetry` defaults to false in the base
`VueWebview` class, preventing the initialization of `loadMetadata`
during webview setup. Without `loadMetadata`, the webview cannot track
load timing or emit load telemetry. The error happens
[here](https://github.com/aws/aws-toolkit-vscode/blob/da8fc990bc50689e043ff1d7cbde3615d2d7571e/packages/core/src/webviews/main.ts#L401)
when trying to calculate duration:
```typescript
const duration = globals.clock.Date.now() - this.loadMetadata!.start
```
### After fix:
Toolkit login webview successfully loading with duration metrics.
<img width="2107" height="1115"
alt="after-toolkit-auth-webview-with-load-duration"
src="https://github.com/user-attachments/assets/0f9d5bf4-dc5b-49de-a76e-776670ef683d"
/>
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
0 commit comments