From 690d2be2588613c893a0f8bf7702e1f5bdb7a4ea Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt <2644648+TylerLeonhardt@users.noreply.github.com> Date: Tue, 6 May 2025 15:36:17 -0700 Subject: [PATCH] Clean up some dead code and add a telemetry even to track classic microsoft auth usage (#248256) So we can see how many people disable MSAL. --- .../src/common/telemetryReporter.ts | 7 +++++++ extensions/microsoft-authentication/src/extension.ts | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/extensions/microsoft-authentication/src/common/telemetryReporter.ts b/extensions/microsoft-authentication/src/common/telemetryReporter.ts index c28aa887e0c..e18c743de9b 100644 --- a/extensions/microsoft-authentication/src/common/telemetryReporter.ts +++ b/extensions/microsoft-authentication/src/common/telemetryReporter.ts @@ -35,6 +35,13 @@ export class MicrosoftAuthenticationTelemetryReporter implements IExperimentatio ); } + sendActivatedWithClassicImplementationEvent(): void { + /* __GDPR__ + "activatingClassic" : { "owner": "TylerLeonhardt", "comment": "Used to determine how often users use the classic login flow." } + */ + this._telemetryReporter.sendTelemetryEvent('activatingClassic'); + } + sendLoginEvent(scopes: readonly string[]): void { /* __GDPR__ "login" : { diff --git a/extensions/microsoft-authentication/src/extension.ts b/extensions/microsoft-authentication/src/extension.ts index bd32a82290a..6a5fac9765d 100644 --- a/extensions/microsoft-authentication/src/extension.ts +++ b/extensions/microsoft-authentication/src/extension.ts @@ -48,14 +48,12 @@ export async function activate(context: ExtensionContext) { env.uriScheme !== 'vscode', // isPreRelease ); useMsal = shouldUseMsal(expService); - const clientIdVersion = workspace.getConfiguration('microsoft-authentication').get<'v1' | 'v2'>('clientIdVersion', 'v1'); - context.subscriptions.push(workspace.onDidChangeConfiguration(async e => { if (!e.affectsConfiguration('microsoft-authentication')) { return; } - if (useMsal === shouldUseMsal(expService) && clientIdVersion === workspace.getConfiguration('microsoft-authentication').get<'v1' | 'v2'>('clientIdVersion', 'v1')) { + if (useMsal === shouldUseMsal(expService)) { return; } @@ -77,6 +75,7 @@ export async function activate(context: ExtensionContext) { if (useMsal && typeof navigator === 'undefined') { await extensionV2.activate(context, mainTelemetryReporter); } else { + mainTelemetryReporter.sendActivatedWithClassicImplementationEvent(); await extensionV1.activate(context, mainTelemetryReporter.telemetryReporter); } }