fix(core): use constant for tool_output_truncated event name (#10372)

This commit is contained in:
Jerop Kipruto
2025-10-02 12:51:14 -04:00
committed by GitHub
parent 99958c68e7
commit eae8b8b1a1
3 changed files with 5 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ export const EVENT_CONTENT_RETRY = 'gemini_cli.chat.content_retry';
export const EVENT_CONTENT_RETRY_FAILURE =
'gemini_cli.chat.content_retry_failure';
export const EVENT_FILE_OPERATION = 'gemini_cli.file_operation';
export const EVENT_TOOL_OUTPUT_TRUNCATED = 'gemini_cli.tool_output_truncated';
export const EVENT_MODEL_SLASH_COMMAND = 'gemini_cli.slash_command.model';
export const EVENT_SMART_EDIT_STRATEGY = 'gemini_cli.smart_edit.strategy';
export const EVENT_MODEL_ROUTING = 'gemini_cli.model_routing';

View File

@@ -37,6 +37,7 @@ import {
EVENT_EXTENSION_DISABLE,
EVENT_EXTENSION_INSTALL,
EVENT_EXTENSION_UNINSTALL,
EVENT_TOOL_OUTPUT_TRUNCATED,
} from './constants.js';
import {
logApiRequest,
@@ -1173,7 +1174,7 @@ describe('loggers', () => {
attributes: {
'session.id': 'test-session-id',
'user.email': 'test-user@example.com',
'event.name': 'tool_output_truncated',
'event.name': EVENT_TOOL_OUTPUT_TRUNCATED,
'event.timestamp': '2025-01-01T00:00:00.000Z',
eventName: 'tool_output_truncated',
prompt_id: 'prompt-id-1',

View File

@@ -29,6 +29,7 @@ import {
EVENT_CONTENT_RETRY,
EVENT_CONTENT_RETRY_FAILURE,
EVENT_FILE_OPERATION,
EVENT_TOOL_OUTPUT_TRUNCATED,
EVENT_RIPGREP_FALLBACK,
EVENT_MODEL_ROUTING,
EVENT_EXTENSION_INSTALL,
@@ -214,7 +215,7 @@ export function logToolOutputTruncated(
const attributes: LogAttributes = {
...getCommonAttributes(config),
...event,
'event.name': 'tool_output_truncated',
'event.name': EVENT_TOOL_OUTPUT_TRUNCATED,
'event.timestamp': new Date().toISOString(),
};