mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
feat(core): set up onboarding telemetry (#23118)
Co-authored-by: Yuna Seol <yunaseol@google.com>
This commit is contained in:
@@ -51,6 +51,8 @@ const KEYCHAIN_AVAILABILITY_COUNT = 'gemini_cli.keychain.availability.count';
|
||||
const TOKEN_STORAGE_TYPE_COUNT = 'gemini_cli.token_storage.type.count';
|
||||
const OVERAGE_OPTION_COUNT = 'gemini_cli.overage_option.count';
|
||||
const CREDIT_PURCHASE_COUNT = 'gemini_cli.credit_purchase.count';
|
||||
const EVENT_ONBOARDING_START = 'gemini_cli.onboarding.start';
|
||||
const EVENT_ONBOARDING_SUCCESS = 'gemini_cli.onboarding.success';
|
||||
|
||||
// Agent Metrics
|
||||
const AGENT_RUN_COUNT = 'gemini_cli.agent.run.count';
|
||||
@@ -299,6 +301,20 @@ const COUNTER_DEFINITIONS = {
|
||||
model: string;
|
||||
},
|
||||
},
|
||||
[EVENT_ONBOARDING_START]: {
|
||||
description: 'Counts onboarding started',
|
||||
valueType: ValueType.INT,
|
||||
assign: (c: Counter) => (onboardingStartCounter = c),
|
||||
attributes: {} as Record<string, never>,
|
||||
},
|
||||
[EVENT_ONBOARDING_SUCCESS]: {
|
||||
description: 'Counts onboarding succeeded',
|
||||
valueType: ValueType.INT,
|
||||
assign: (c: Counter) => (onboardingSuccessCounter = c),
|
||||
attributes: {} as {
|
||||
user_tier?: string;
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
const HISTOGRAM_DEFINITIONS = {
|
||||
@@ -640,6 +656,8 @@ let keychainAvailabilityCounter: Counter | undefined;
|
||||
let tokenStorageTypeCounter: Counter | undefined;
|
||||
let overageOptionCounter: Counter | undefined;
|
||||
let creditPurchaseCounter: Counter | undefined;
|
||||
let onboardingStartCounter: Counter | undefined;
|
||||
let onboardingSuccessCounter: Counter | undefined;
|
||||
|
||||
// OpenTelemetry GenAI Semantic Convention Metrics
|
||||
let genAiClientTokenUsageHistogram: Histogram | undefined;
|
||||
@@ -812,6 +830,31 @@ export function recordLinesChanged(
|
||||
|
||||
// --- New Metric Recording Functions ---
|
||||
|
||||
/**
|
||||
* Records a metric for when the Google auth process starts.
|
||||
*/
|
||||
export function recordOnboardingStart(config: Config): void {
|
||||
if (!onboardingStartCounter || !isMetricsInitialized) return;
|
||||
onboardingStartCounter.add(
|
||||
1,
|
||||
baseMetricDefinition.getCommonAttributes(config),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Records a metric for when the Google auth process ends successfully.
|
||||
*/
|
||||
export function recordOnboardingSuccess(
|
||||
config: Config,
|
||||
userTier?: string,
|
||||
): void {
|
||||
if (!onboardingSuccessCounter || !isMetricsInitialized) return;
|
||||
onboardingSuccessCounter.add(1, {
|
||||
...baseMetricDefinition.getCommonAttributes(config),
|
||||
...(userTier && { user_tier: userTier }),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Records a metric for when a UI frame flickers.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user