mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-22 20:14:58 -07:00
Moved client id logging into createBasicLogEvent (#13607)
This commit is contained in:
@@ -292,8 +292,10 @@ export class ClearcutLogger {
|
||||
eventName: EventNames,
|
||||
data: EventValue[] = [],
|
||||
): LogEvent {
|
||||
const email = this.userAccountManager.getCachedGoogleAccount();
|
||||
const surface = determineSurface();
|
||||
const ghWorkflowName = determineGHWorkflowName();
|
||||
|
||||
const baseMetadata: EventValue[] = [
|
||||
...data,
|
||||
{
|
||||
@@ -321,25 +323,12 @@ export class ClearcutLogger {
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
const logEvent: LogEvent = {
|
||||
console_type: 'GEMINI_CLI',
|
||||
application: 102, // GEMINI_CLI
|
||||
event_name: eventName as string,
|
||||
event_metadata: [baseMetadata],
|
||||
};
|
||||
}
|
||||
|
||||
createLogEvent(eventName: EventNames, data: EventValue[] = []): LogEvent {
|
||||
const email = this.userAccountManager.getCachedGoogleAccount();
|
||||
|
||||
if (eventName !== EventNames.START_SESSION) {
|
||||
data.push(...this.sessionData);
|
||||
}
|
||||
const totalAccounts = this.userAccountManager.getLifetimeGoogleAccounts();
|
||||
|
||||
data = this.addDefaultFields(data, totalAccounts);
|
||||
|
||||
const logEvent = this.createBasicLogEvent(eventName, data);
|
||||
|
||||
// Should log either email or install ID, not both. See go/cloudmill-1p-oss-instrumentation#define-sessionable-id
|
||||
if (email) {
|
||||
@@ -351,6 +340,17 @@ export class ClearcutLogger {
|
||||
return logEvent;
|
||||
}
|
||||
|
||||
createLogEvent(eventName: EventNames, data: EventValue[] = []): LogEvent {
|
||||
if (eventName !== EventNames.START_SESSION) {
|
||||
data.push(...this.sessionData);
|
||||
}
|
||||
const totalAccounts = this.userAccountManager.getLifetimeGoogleAccounts();
|
||||
|
||||
data = this.addDefaultFields(data, totalAccounts);
|
||||
|
||||
return this.createBasicLogEvent(eventName, data);
|
||||
}
|
||||
|
||||
flushIfNeeded(): void {
|
||||
if (Date.now() - this.lastFlushTime < FLUSH_INTERVAL_MS) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user