mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
add(telemetry): Add missing telemetry for UserPromptEvent (#6885)
Co-authored-by: Shnatu <snatu@google.com> Co-authored-by: Arya Gummadi <aryagummadi@google.com>
This commit is contained in:
@@ -208,6 +208,8 @@ describe('loggers', () => {
|
||||
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
||||
prompt_length: 11,
|
||||
prompt: 'test-prompt',
|
||||
prompt_id: 'prompt-id-8',
|
||||
auth_type: 'vertex-ai',
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -222,8 +224,9 @@ describe('loggers', () => {
|
||||
} as unknown as Config;
|
||||
const event = new UserPromptEvent(
|
||||
11,
|
||||
'test-prompt',
|
||||
'prompt-id-9',
|
||||
AuthType.CLOUD_SHELL,
|
||||
'test-prompt',
|
||||
);
|
||||
|
||||
logUserPrompt(mockConfig, event);
|
||||
@@ -236,6 +239,8 @@ describe('loggers', () => {
|
||||
'event.name': EVENT_USER_PROMPT,
|
||||
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
||||
prompt_length: 11,
|
||||
prompt_id: 'prompt-id-9',
|
||||
auth_type: 'cloud-shell',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -122,8 +122,13 @@ export function logUserPrompt(config: Config, event: UserPromptEvent): void {
|
||||
'event.name': EVENT_USER_PROMPT,
|
||||
'event.timestamp': new Date().toISOString(),
|
||||
prompt_length: event.prompt_length,
|
||||
prompt_id: event.prompt_id,
|
||||
};
|
||||
|
||||
if (event.auth_type) {
|
||||
attributes['auth_type'] = event.auth_type;
|
||||
}
|
||||
|
||||
if (shouldLogUserPrompts(config)) {
|
||||
attributes['prompt'] = event.prompt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user