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