feat(telemetry): add onboarding start and end metrics for login with google

This commit is contained in:
Srinath Padmanabhan
2026-02-17 09:28:56 -08:00
parent 5f2f60bed6
commit ed2204ffce
3 changed files with 113 additions and 3 deletions
+23
View File
@@ -19,6 +19,10 @@ import { EventEmitter } from 'node:events';
import open from 'open';
import path from 'node:path';
import { promises as fs } from 'node:fs';
import {
recordOnboardingStart,
recordOnboardingEnd,
} from '../telemetry/metrics.js';
import type { Config } from '../config/config.js';
import {
getErrorMessage,
@@ -140,6 +144,11 @@ async function initOauthClient(
proxy: config.getProxy(),
},
});
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
recordOnboardingStart(config);
}
const useEncryptedStorage = getUseEncryptedStorageFlag();
if (
@@ -161,6 +170,10 @@ async function initOauthClient(
}
await triggerPostAuthCallbacks(tokens);
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
recordOnboardingEnd(config);
}
});
if (credentials) {
@@ -186,6 +199,10 @@ async function initOauthClient(
debugLogger.log('Loaded cached credentials.');
await triggerPostAuthCallbacks(credentials as Credentials);
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
recordOnboardingEnd(config);
}
return client;
}
} catch (error) {
@@ -270,6 +287,9 @@ async function initOauthClient(
}
await triggerPostAuthCallbacks(client.credentials);
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
recordOnboardingEnd(config);
}
} else {
// In Zed integration, we skip the interactive consent and directly open the browser
if (!config.getExperimentalZedIntegration()) {
@@ -376,6 +396,9 @@ async function initOauthClient(
});
await triggerPostAuthCallbacks(client.credentials);
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
recordOnboardingEnd(config);
}
}
return client;