mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-23 03:24:42 -07:00
feat(telemetry): add onboarding start and end metrics for login with google
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user