From 6535215f73ebf5a8743fdfebbd9b6243ae3c676f Mon Sep 17 00:00:00 2001 From: MicroFish91 <40250218+MicroFish91@users.noreply.github.com> Date: Thu, 12 Feb 2026 12:49:38 -0800 Subject: [PATCH 1/4] Add duration telemetry --- src/commands/api/createContainerAppsApiProvider.ts | 1 + src/extension.ts | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/commands/api/createContainerAppsApiProvider.ts b/src/commands/api/createContainerAppsApiProvider.ts index d5fc4b6d..e84252dd 100644 --- a/src/commands/api/createContainerAppsApiProvider.ts +++ b/src/commands/api/createContainerAppsApiProvider.ts @@ -18,6 +18,7 @@ export function createContainerAppsApiProvider(registerBranchResources: AzureRes onDidReceiveAzureResourcesApis: registerBranchResources, onApiRequestError: async (error: AzureResourcesApiRequestError) => { await callWithTelemetryAndErrorHandling('hostApiRequestFailed', (actionContext: IActionContext) => { + actionContext.telemetry.properties.isActivationEvent = 'true'; actionContext.telemetry.properties.hostApiRequestErrorCode = error.code; actionContext.telemetry.properties.hostApiRequestError = maskUserInfo(error.message, []); ext.outputChannel.appendLog(localize('apiRequestError', 'Error: Failed to connect extension to the Azure Resources host.')); diff --git a/src/extension.ts b/src/extension.ts index 73019c22..9d8584fd 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -9,6 +9,7 @@ import { registerAzureUtilsExtensionVariables } from '@microsoft/vscode-azext-az import { registerGitHubExtensionVariables } from '@microsoft/vscode-azext-github'; import { TreeElementStateManager, callWithTelemetryAndErrorHandling, createApiProvider, createAzExtOutputChannel, createExperimentationService, registerUIExtensionVariables, type IActionContext, type apiUtils } from '@microsoft/vscode-azext-utils'; import { AzExtResourceType, type AzureResourcesExtensionApi } from '@microsoft/vscode-azureresources-api'; +import { v4 as uuid } from 'uuid'; import * as vscode from 'vscode'; import { createContainerAppsApiProvider } from './commands/api/createContainerAppsApiProvider'; import { registerCommands } from './commands/registerCommands'; @@ -44,8 +45,15 @@ export async function activate(context: vscode.ExtensionContext, perfStats: { lo ext.state = new TreeElementStateManager(); ext.branchDataProvider = new ContainerAppsBranchDataProvider(); + const authHandshakeId = uuid(); + const authHandshakeStartMs = Date.now(); + activateContext.telemetry.properties.authHandshakeId = authHandshakeId; + const registerBranchResources = async (azureResourcesApis: (AzureResourcesExtensionApi | undefined)[]) => { await callWithTelemetryAndErrorHandling('hostApiRequestSucceeded', (actionContext: IActionContext) => { + actionContext.telemetry.properties.authHandshakeDurationMs = String(Date.now() - authHandshakeStartMs); + actionContext.telemetry.properties.authHandshakeId = authHandshakeId; + actionContext.telemetry.properties.isActivationEvent = 'true'; actionContext.errorHandling.rethrow = true; const [rgApiV2] = azureResourcesApis; From bea905125882c3dc5a66b0f82ec281486b964dc7 Mon Sep 17 00:00:00 2001 From: MicroFish91 <40250218+MicroFish91@users.noreply.github.com> Date: Thu, 12 Feb 2026 14:41:55 -0800 Subject: [PATCH 2/4] Keep duration in seconds instead of ms --- src/extension.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 9d8584fd..725e7dba 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -51,7 +51,8 @@ export async function activate(context: vscode.ExtensionContext, perfStats: { lo const registerBranchResources = async (azureResourcesApis: (AzureResourcesExtensionApi | undefined)[]) => { await callWithTelemetryAndErrorHandling('hostApiRequestSucceeded', (actionContext: IActionContext) => { - actionContext.telemetry.properties.authHandshakeDurationMs = String(Date.now() - authHandshakeStartMs); + console.log('authHandshakeDuration: ' + (Date.now() - authHandshakeStartMs) / 1000); + actionContext.telemetry.properties.authHandshakeDuration = String((Date.now() - authHandshakeStartMs) / 1000); actionContext.telemetry.properties.authHandshakeId = authHandshakeId; actionContext.telemetry.properties.isActivationEvent = 'true'; actionContext.errorHandling.rethrow = true; From 178c670b4980497e6dba6ff8c4600dddd72c7478 Mon Sep 17 00:00:00 2001 From: MicroFish91 <40250218+MicroFish91@users.noreply.github.com> Date: Thu, 12 Feb 2026 14:43:01 -0800 Subject: [PATCH 3/4] Remove log --- src/extension.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 725e7dba..fb8d04df 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -51,7 +51,6 @@ export async function activate(context: vscode.ExtensionContext, perfStats: { lo const registerBranchResources = async (azureResourcesApis: (AzureResourcesExtensionApi | undefined)[]) => { await callWithTelemetryAndErrorHandling('hostApiRequestSucceeded', (actionContext: IActionContext) => { - console.log('authHandshakeDuration: ' + (Date.now() - authHandshakeStartMs) / 1000); actionContext.telemetry.properties.authHandshakeDuration = String((Date.now() - authHandshakeStartMs) / 1000); actionContext.telemetry.properties.authHandshakeId = authHandshakeId; actionContext.telemetry.properties.isActivationEvent = 'true'; From 4ac4788a1b6eb8af1502064cddffe1eae717e226 Mon Sep 17 00:00:00 2001 From: MicroFish91 <40250218+MicroFish91@users.noreply.github.com> Date: Tue, 17 Feb 2026 10:44:35 -0800 Subject: [PATCH 4/4] Use measurements in telemetry --- src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index fb8d04df..3a05f1bd 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -51,7 +51,7 @@ export async function activate(context: vscode.ExtensionContext, perfStats: { lo const registerBranchResources = async (azureResourcesApis: (AzureResourcesExtensionApi | undefined)[]) => { await callWithTelemetryAndErrorHandling('hostApiRequestSucceeded', (actionContext: IActionContext) => { - actionContext.telemetry.properties.authHandshakeDuration = String((Date.now() - authHandshakeStartMs) / 1000); + actionContext.telemetry.measurements.authHandshakeDuration = (Date.now() - authHandshakeStartMs) / 1000; actionContext.telemetry.properties.authHandshakeId = authHandshakeId; actionContext.telemetry.properties.isActivationEvent = 'true'; actionContext.errorHandling.rethrow = true;