feat(core): add robustness tests, logging, and metrics for CodeAssistServer SSE parsing (#21013)

Co-authored-by: Yuna Seol <yunaseol@google.com>
This commit is contained in:
Yuna Seol
2026-03-04 14:27:47 -05:00
committed by GitHub
parent 7423139905
commit 7e510951d7
5 changed files with 338 additions and 5 deletions
+18
View File
@@ -29,6 +29,7 @@ import {
type ConversationFinishedEvent,
type ChatCompressionEvent,
type MalformedJsonResponseEvent,
type InvalidChunkEvent,
type ContentRetryEvent,
type ContentRetryFailureEvent,
type RipgrepFallbackEvent,
@@ -75,6 +76,7 @@ import {
recordPlanExecution,
recordKeychainAvailability,
recordTokenStorageInitialization,
recordInvalidChunk,
} from './metrics.js';
import { bufferTelemetryEvent } from './sdk.js';
import { uiTelemetryService, type UiEvent } from './uiTelemetry.js';
@@ -467,6 +469,22 @@ export function logMalformedJsonResponse(
});
}
export function logInvalidChunk(
config: Config,
event: InvalidChunkEvent,
): void {
ClearcutLogger.getInstance(config)?.logInvalidChunkEvent(event);
bufferTelemetryEvent(() => {
const logger = logs.getLogger(SERVICE_NAME);
const logRecord: LogRecord = {
body: event.toLogBody(),
attributes: event.toOpenTelemetryAttributes(config),
};
logger.emit(logRecord);
recordInvalidChunk(config);
});
}
export function logContentRetry(
config: Config,
event: ContentRetryEvent,