Commit 9b0deb2
authored
telemetry(auth): Enable load telemetry for Toolkit login webview (#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](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.1 parent 21ef0b1 commit 9b0deb2
File tree
1 file changed
+1
-0
lines changed- packages/core/src/login/webview/vue/toolkit
1 file changed
+1
-0
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
0 commit comments