diff options
| author | Jerop Kipruto <[email protected]> | 2025-06-23 18:05:02 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-23 22:05:02 +0000 |
| commit | b443b5e800ec3ab20aacfca759229b3939abcaeb (patch) | |
| tree | 7f94b1bf7d31351b87c9fad40c4e1009450ee67a /packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts | |
| parent | 58572a6eaab903a94402d4d9fa56e16b354d5330 (diff) | |
Ensure telemetry events are flushed immediately (#1344)
The previous implementation used `flushIfNeeded` to batch most telemetry events, but it was not reliably sending them, leading to data loss. Notably, the `startSession` event, which already used `flushToClearcut`, was working correctly, indicating an issue with the batching logic itself.
This change replaces all calls to `flushIfNeeded` with `flushToClearcut` to align all event logging with the working `startSession` implementation and ensure that events are sent immediately. This prioritizes the reliability of data collection over network efficiency.
This is a temporary solution to prevent further data loss. The underlying issue with the batching mechanism in `flushIfNeeded` should be investigated and fixed in the future, at which point this change can be reverted.
Diffstat (limited to 'packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts')
| -rw-r--r-- | packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts b/packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts index b29f4133..50f2fffa 100644 --- a/packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts +++ b/packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts @@ -249,7 +249,7 @@ export class ClearcutLogger { ); this.enqueueLogEvent(this.createLogEvent(new_prompt_event_name, data)); - this.flushIfNeeded(); + this.flushToClearcut(); } logToolCallEvent(event: ToolCallEvent): void { @@ -278,7 +278,7 @@ export class ClearcutLogger { ); this.enqueueLogEvent(this.createLogEvent(tool_call_event_name, data)); - this.flushIfNeeded(); + this.flushToClearcut(); } logApiRequestEvent(event: ApiRequestEvent): void { @@ -287,7 +287,7 @@ export class ClearcutLogger { data.set(EventMetadataKey.GEMINI_CLI_API_REQUEST_MODEL, event.model); this.enqueueLogEvent(this.createLogEvent(api_request_event_name, data)); - this.flushIfNeeded(); + this.flushToClearcut(); } logApiResponseEvent(event: ApiResponseEvent): void { @@ -328,7 +328,7 @@ export class ClearcutLogger { ); this.enqueueLogEvent(this.createLogEvent(api_response_event_name, data)); - this.flushIfNeeded(); + this.flushToClearcut(); } logApiErrorEvent(event: ApiErrorEvent): void { @@ -349,7 +349,7 @@ export class ClearcutLogger { ); this.enqueueLogEvent(this.createLogEvent(api_error_event_name, data)); - this.flushIfNeeded(); + this.flushToClearcut(); } logEndSessionEvent(event: EndSessionEvent): void { |
