@@ -292,8 +292,10 @@ export class ClearcutLogger {
292292 eventName : EventNames ,
293293 data : EventValue [ ] = [ ] ,
294294 ) : LogEvent {
295+ const email = this . userAccountManager . getCachedGoogleAccount ( ) ;
295296 const surface = determineSurface ( ) ;
296297 const ghWorkflowName = determineGHWorkflowName ( ) ;
298+
297299 const baseMetadata : EventValue [ ] = [
298300 ...data ,
299301 {
@@ -321,34 +323,32 @@ export class ClearcutLogger {
321323 } ) ;
322324 }
323325
324- return {
326+ const logEvent : LogEvent = {
325327 console_type : 'GEMINI_CLI' ,
326328 application : 102 , // GEMINI_CLI
327329 event_name : eventName as string ,
328330 event_metadata : [ baseMetadata ] ,
329331 } ;
332+
333+ // Should log either email or install ID, not both. See go/cloudmill-1p-oss-instrumentation#define-sessionable-id
334+ if ( email ) {
335+ logEvent . client_email = email ;
336+ } else {
337+ logEvent . client_install_id = this . installationManager . getInstallationId ( ) ;
338+ }
339+
340+ return logEvent ;
330341 }
331342
332343 createLogEvent ( eventName : EventNames , data : EventValue [ ] = [ ] ) : LogEvent {
333- const email = this . userAccountManager . getCachedGoogleAccount ( ) ;
334-
335344 if ( eventName !== EventNames . START_SESSION ) {
336345 data . push ( ...this . sessionData ) ;
337346 }
338347 const totalAccounts = this . userAccountManager . getLifetimeGoogleAccounts ( ) ;
339348
340349 data = this . addDefaultFields ( data , totalAccounts ) ;
341350
342- const logEvent = this . createBasicLogEvent ( eventName , data ) ;
343-
344- // Should log either email or install ID, not both. See go/cloudmill-1p-oss-instrumentation#define-sessionable-id
345- if ( email ) {
346- logEvent . client_email = email ;
347- } else {
348- logEvent . client_install_id = this . installationManager . getInstallationId ( ) ;
349- }
350-
351- return logEvent ;
351+ return this . createBasicLogEvent ( eventName , data ) ;
352352 }
353353
354354 flushIfNeeded ( ) : void {
0 commit comments