Skip to content

Commit 9b0deb2

Browse files
authored
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.
1 parent 21ef0b1 commit 9b0deb2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/core/src/login/webview/vue/toolkit/backend_toolkit.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import globals from '../../../../shared/extensionGlobals'
2828
export class ToolkitLoginWebview extends CommonAuthWebview {
2929
public override id: string = 'aws.toolkit.AmazonCommonAuth'
3030
public static sourcePath: string = 'vue/src/login/webview/vue/toolkit/index.js'
31+
public override supportsLoadTelemetry: boolean = true
3132
private isCodeCatalystLogin = false
3233

3334
override onActiveConnectionModified: vscode.EventEmitter<void> = new vscode.EventEmitter()

0 commit comments

Comments
 (0)