mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
refactor(telemetry): pass config object to telemetry functions
This commit refactors the telemetry system to pass a object to various logging and metrics functions. This change centralizes configuration management within the telemetry system, making it more modular and easier to maintain. The constructor and various tool execution functions have been updated to accept the object, which is then passed down to the telemetry functions. This eliminates the need to pass individual configuration values, such as , through multiple layers of the application.
This commit is contained in:
@@ -160,9 +160,9 @@ export class GeminiClient {
|
||||
const systemInstruction = getCoreSystemPrompt(userMemory);
|
||||
|
||||
return new GeminiChat(
|
||||
this.config,
|
||||
await this.contentGenerator,
|
||||
this.model,
|
||||
this.config.getSessionId(),
|
||||
{
|
||||
systemInstruction,
|
||||
...this.generateContentConfig,
|
||||
@@ -214,7 +214,7 @@ export class GeminiClient {
|
||||
}
|
||||
|
||||
private _logApiRequest(model: string, inputTokenCount: number): void {
|
||||
logApiRequest({
|
||||
logApiRequest(this.config, {
|
||||
model,
|
||||
input_token_count: inputTokenCount,
|
||||
duration_ms: 0, // Duration is not known at request time
|
||||
@@ -239,7 +239,7 @@ export class GeminiClient {
|
||||
responseError = `Finished with reason: ${finishReason}`;
|
||||
}
|
||||
|
||||
logApiResponse({
|
||||
logApiResponse(this.config, {
|
||||
model,
|
||||
duration_ms: durationMs,
|
||||
attempt,
|
||||
@@ -277,7 +277,7 @@ export class GeminiClient {
|
||||
}
|
||||
}
|
||||
|
||||
logApiError({
|
||||
logApiError(this.config, {
|
||||
model,
|
||||
error: errorMessage,
|
||||
status_code: statusCode,
|
||||
|
||||
Reference in New Issue
Block a user