Fix circular reference JSON serialization in telemetry logging (#4150)

This commit is contained in:
Bryan Morgan
2025-07-14 16:20:06 -04:00
committed by GitHub
parent 5008aea90d
commit ff3722a3a7
7 changed files with 294 additions and 17 deletions

View File

@@ -23,6 +23,7 @@ import {
getCachedGoogleAccount,
getLifetimeGoogleAccounts,
} from '../../utils/user_account.js';
import { safeJsonStringify } from '../../utils/safeJsonStringify.js';
const start_session_event_name = 'start_session';
const new_prompt_event_name = 'new_prompt';
@@ -65,7 +66,7 @@ export class ClearcutLogger {
this.events.push([
{
event_time_ms: Date.now(),
source_extension_json: JSON.stringify(event),
source_extension_json: safeJsonStringify(event),
},
]);
}
@@ -121,7 +122,7 @@ export class ClearcutLogger {
log_event: eventsToSend,
},
];
const body = JSON.stringify(request);
const body = safeJsonStringify(request);
const options = {
hostname: 'play.googleapis.com',
path: '/log',