@google/gemini-cli-core 0.10.0-nightly.20251009.cd354aeb → 0.10.0-nightly.20251010.558be873
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/config/config.d.ts +3 -0
- package/dist/src/config/config.js +5 -0
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +22 -0
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/core/client.d.ts +1 -1
- package/dist/src/core/client.js +16 -3
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +85 -0
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/turn.d.ts +6 -2
- package/dist/src/core/turn.js +6 -0
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +13 -1
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +12 -4
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/constants.d.ts +0 -34
- package/dist/src/telemetry/constants.js +0 -36
- package/dist/src/telemetry/constants.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +1 -1
- package/dist/src/telemetry/loggers.js +83 -315
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +5 -2
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +5 -1
- package/dist/src/telemetry/metrics.js +2 -1
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/telemetryAttributes.d.ts +8 -0
- package/dist/src/telemetry/telemetryAttributes.js +15 -0
- package/dist/src/telemetry/telemetryAttributes.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +100 -2
- package/dist/src/telemetry/types.js +570 -33
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +1 -1
- package/dist/src/telemetry/uiTelemetry.js +1 -1
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/tools/smart-edit.d.ts +0 -19
- package/dist/src/tools/smart-edit.js +11 -47
- package/dist/src/tools/smart-edit.js.map +1 -1
- package/dist/src/tools/smart-edit.test.js +0 -59
- package/dist/src/tools/smart-edit.test.js.map +1 -1
- package/dist/src/tools/tool-error.d.ts +21 -0
- package/dist/src/tools/tool-error.js +27 -0
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/utils/pathCorrector.d.ts +25 -0
- package/dist/src/utils/pathCorrector.js +33 -0
- package/dist/src/utils/pathCorrector.js.map +1 -0
- package/dist/src/utils/pathCorrector.test.d.ts +6 -0
- package/dist/src/utils/pathCorrector.test.js +83 -0
- package/dist/src/utils/pathCorrector.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,10 @@ import { DiscoveredMCPTool } from '../tools/mcp-tool.js';
|
|
|
7
7
|
import { AuthType } from '../core/contentGenerator.js';
|
|
8
8
|
import { getDecisionFromOutcome, ToolCallDecision, } from './tool-call-decision.js';
|
|
9
9
|
export { ToolCallDecision };
|
|
10
|
+
import { getCommonAttributes } from './telemetryAttributes.js';
|
|
11
|
+
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
|
|
12
|
+
import { safeJsonStringify } from '../utils/safeJsonStringify.js';
|
|
13
|
+
export const EVENT_CLI_CONFIG = 'gemini_cli.config';
|
|
10
14
|
export class StartSessionEvent {
|
|
11
15
|
'event.name';
|
|
12
16
|
'event.timestamp';
|
|
@@ -36,6 +40,7 @@ export class StartSessionEvent {
|
|
|
36
40
|
useVertex = generatorConfig.authType === AuthType.USE_VERTEX_AI;
|
|
37
41
|
}
|
|
38
42
|
this['event.name'] = 'cli_config';
|
|
43
|
+
this['event.timestamp'] = new Date().toISOString();
|
|
39
44
|
this.model = config.getModel();
|
|
40
45
|
this.embedding_model = config.getEmbeddingModel();
|
|
41
46
|
this.sandbox_enabled =
|
|
@@ -63,6 +68,31 @@ export class StartSessionEvent {
|
|
|
63
68
|
.join(',');
|
|
64
69
|
}
|
|
65
70
|
}
|
|
71
|
+
toOpenTelemetryAttributes(config) {
|
|
72
|
+
return {
|
|
73
|
+
...getCommonAttributes(config),
|
|
74
|
+
'event.name': EVENT_CLI_CONFIG,
|
|
75
|
+
'event.timestamp': this['event.timestamp'],
|
|
76
|
+
model: this.model,
|
|
77
|
+
embedding_model: this.embedding_model,
|
|
78
|
+
sandbox_enabled: this.sandbox_enabled,
|
|
79
|
+
core_tools_enabled: this.core_tools_enabled,
|
|
80
|
+
approval_mode: this.approval_mode,
|
|
81
|
+
api_key_enabled: this.api_key_enabled,
|
|
82
|
+
vertex_ai_enabled: this.vertex_ai_enabled,
|
|
83
|
+
log_user_prompts_enabled: this.telemetry_log_user_prompts_enabled,
|
|
84
|
+
file_filtering_respect_git_ignore: this.file_filtering_respect_git_ignore,
|
|
85
|
+
debug_mode: this.debug_enabled,
|
|
86
|
+
mcp_servers: this.mcp_servers,
|
|
87
|
+
mcp_servers_count: this.mcp_servers_count,
|
|
88
|
+
mcp_tools: this.mcp_tools,
|
|
89
|
+
mcp_tools_count: this.mcp_tools_count,
|
|
90
|
+
output_format: this.output_format,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
toLogBody() {
|
|
94
|
+
return 'CLI configuration loaded.';
|
|
95
|
+
}
|
|
66
96
|
}
|
|
67
97
|
export class EndSessionEvent {
|
|
68
98
|
'event.name';
|
|
@@ -74,6 +104,7 @@ export class EndSessionEvent {
|
|
|
74
104
|
this.session_id = config?.getSessionId();
|
|
75
105
|
}
|
|
76
106
|
}
|
|
107
|
+
export const EVENT_USER_PROMPT = 'gemini_cli.user_prompt';
|
|
77
108
|
export class UserPromptEvent {
|
|
78
109
|
'event.name';
|
|
79
110
|
'event.timestamp';
|
|
@@ -89,7 +120,27 @@ export class UserPromptEvent {
|
|
|
89
120
|
this.auth_type = auth_type;
|
|
90
121
|
this.prompt = prompt;
|
|
91
122
|
}
|
|
123
|
+
toOpenTelemetryAttributes(config) {
|
|
124
|
+
const attributes = {
|
|
125
|
+
...getCommonAttributes(config),
|
|
126
|
+
'event.name': EVENT_USER_PROMPT,
|
|
127
|
+
'event.timestamp': this['event.timestamp'],
|
|
128
|
+
prompt_length: this.prompt_length,
|
|
129
|
+
prompt_id: this.prompt_id,
|
|
130
|
+
};
|
|
131
|
+
if (this.auth_type) {
|
|
132
|
+
attributes['auth_type'] = this.auth_type;
|
|
133
|
+
}
|
|
134
|
+
if (config.getTelemetryLogPromptsEnabled()) {
|
|
135
|
+
attributes['prompt'] = this.prompt;
|
|
136
|
+
}
|
|
137
|
+
return attributes;
|
|
138
|
+
}
|
|
139
|
+
toLogBody() {
|
|
140
|
+
return `User prompt. Length: ${this.prompt_length}.`;
|
|
141
|
+
}
|
|
92
142
|
}
|
|
143
|
+
export const EVENT_TOOL_CALL = 'gemini_cli.tool_call';
|
|
93
144
|
export class ToolCallEvent {
|
|
94
145
|
'event.name';
|
|
95
146
|
'event.timestamp';
|
|
@@ -106,48 +157,89 @@ export class ToolCallEvent {
|
|
|
106
157
|
mcp_server_name;
|
|
107
158
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
159
|
metadata;
|
|
109
|
-
constructor(call) {
|
|
160
|
+
constructor(call, function_name, function_args, duration_ms, success, prompt_id, tool_type, error) {
|
|
110
161
|
this['event.name'] = 'tool_call';
|
|
111
162
|
this['event.timestamp'] = new Date().toISOString();
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
call.tool
|
|
125
|
-
|
|
126
|
-
|
|
163
|
+
if (call) {
|
|
164
|
+
this.function_name = call.request.name;
|
|
165
|
+
this.function_args = call.request.args;
|
|
166
|
+
this.duration_ms = call.durationMs ?? 0;
|
|
167
|
+
this.success = call.status === 'success';
|
|
168
|
+
this.decision = call.outcome
|
|
169
|
+
? getDecisionFromOutcome(call.outcome)
|
|
170
|
+
: undefined;
|
|
171
|
+
this.error = call.response.error?.message;
|
|
172
|
+
this.error_type = call.response.errorType;
|
|
173
|
+
this.prompt_id = call.request.prompt_id;
|
|
174
|
+
this.content_length = call.response.contentLength;
|
|
175
|
+
if (typeof call.tool !== 'undefined' &&
|
|
176
|
+
call.tool instanceof DiscoveredMCPTool) {
|
|
177
|
+
this.tool_type = 'mcp';
|
|
178
|
+
this.mcp_server_name = call.tool.serverName;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
this.tool_type = 'native';
|
|
182
|
+
}
|
|
183
|
+
if (call.status === 'success' &&
|
|
184
|
+
typeof call.response.resultDisplay === 'object' &&
|
|
185
|
+
call.response.resultDisplay !== null &&
|
|
186
|
+
'diffStat' in call.response.resultDisplay) {
|
|
187
|
+
const diffStat = call.response.resultDisplay.diffStat;
|
|
188
|
+
if (diffStat) {
|
|
189
|
+
this.metadata = {
|
|
190
|
+
model_added_lines: diffStat.model_added_lines,
|
|
191
|
+
model_removed_lines: diffStat.model_removed_lines,
|
|
192
|
+
model_added_chars: diffStat.model_added_chars,
|
|
193
|
+
model_removed_chars: diffStat.model_removed_chars,
|
|
194
|
+
user_added_lines: diffStat.user_added_lines,
|
|
195
|
+
user_removed_lines: diffStat.user_removed_lines,
|
|
196
|
+
user_added_chars: diffStat.user_added_chars,
|
|
197
|
+
user_removed_chars: diffStat.user_removed_chars,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
127
201
|
}
|
|
128
202
|
else {
|
|
129
|
-
this.
|
|
203
|
+
this.function_name = function_name;
|
|
204
|
+
this.function_args = function_args;
|
|
205
|
+
this.duration_ms = duration_ms;
|
|
206
|
+
this.success = success;
|
|
207
|
+
this.prompt_id = prompt_id;
|
|
208
|
+
this.tool_type = tool_type;
|
|
209
|
+
this.error = error;
|
|
130
210
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
211
|
+
}
|
|
212
|
+
toOpenTelemetryAttributes(config) {
|
|
213
|
+
const attributes = {
|
|
214
|
+
...getCommonAttributes(config),
|
|
215
|
+
'event.name': EVENT_TOOL_CALL,
|
|
216
|
+
'event.timestamp': this['event.timestamp'],
|
|
217
|
+
function_name: this.function_name,
|
|
218
|
+
function_args: safeJsonStringify(this.function_args, 2),
|
|
219
|
+
duration_ms: this.duration_ms,
|
|
220
|
+
success: this.success,
|
|
221
|
+
decision: this.decision,
|
|
222
|
+
prompt_id: this.prompt_id,
|
|
223
|
+
tool_type: this.tool_type,
|
|
224
|
+
content_length: this.content_length,
|
|
225
|
+
mcp_server_name: this.mcp_server_name,
|
|
226
|
+
metadata: this.metadata,
|
|
227
|
+
};
|
|
228
|
+
if (this.error) {
|
|
229
|
+
attributes['error'] = this.error;
|
|
230
|
+
attributes['error.message'] = this.error;
|
|
231
|
+
if (this.error_type) {
|
|
232
|
+
attributes['error_type'] = this.error_type;
|
|
233
|
+
attributes['error.type'] = this.error_type;
|
|
147
234
|
}
|
|
148
235
|
}
|
|
236
|
+
return attributes;
|
|
237
|
+
}
|
|
238
|
+
toLogBody() {
|
|
239
|
+
return `Tool call: ${this.function_name}${this.decision ? `. Decision: ${this.decision}` : ''}. Success: ${this.success}. Duration: ${this.duration_ms}ms.`;
|
|
149
240
|
}
|
|
150
241
|
}
|
|
242
|
+
export const EVENT_API_REQUEST = 'gemini_cli.api_request';
|
|
151
243
|
export class ApiRequestEvent {
|
|
152
244
|
'event.name';
|
|
153
245
|
'event.timestamp';
|
|
@@ -161,7 +253,21 @@ export class ApiRequestEvent {
|
|
|
161
253
|
this.prompt_id = prompt_id;
|
|
162
254
|
this.request_text = request_text;
|
|
163
255
|
}
|
|
256
|
+
toOpenTelemetryAttributes(config) {
|
|
257
|
+
return {
|
|
258
|
+
...getCommonAttributes(config),
|
|
259
|
+
'event.name': EVENT_API_REQUEST,
|
|
260
|
+
'event.timestamp': this['event.timestamp'],
|
|
261
|
+
model: this.model,
|
|
262
|
+
prompt_id: this.prompt_id,
|
|
263
|
+
request_text: this.request_text,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
toLogBody() {
|
|
267
|
+
return `API request to ${this.model}.`;
|
|
268
|
+
}
|
|
164
269
|
}
|
|
270
|
+
export const EVENT_API_ERROR = 'gemini_cli.api_error';
|
|
165
271
|
export class ApiErrorEvent {
|
|
166
272
|
'event.name';
|
|
167
273
|
'event.timestamp';
|
|
@@ -183,7 +289,34 @@ export class ApiErrorEvent {
|
|
|
183
289
|
this.prompt_id = prompt_id;
|
|
184
290
|
this.auth_type = auth_type;
|
|
185
291
|
}
|
|
292
|
+
toOpenTelemetryAttributes(config) {
|
|
293
|
+
const attributes = {
|
|
294
|
+
...getCommonAttributes(config),
|
|
295
|
+
'event.name': EVENT_API_ERROR,
|
|
296
|
+
'event.timestamp': this['event.timestamp'],
|
|
297
|
+
['error.message']: this.error,
|
|
298
|
+
model_name: this.model,
|
|
299
|
+
duration: this.duration_ms,
|
|
300
|
+
model: this.model,
|
|
301
|
+
error: this.error,
|
|
302
|
+
status_code: this.status_code,
|
|
303
|
+
duration_ms: this.duration_ms,
|
|
304
|
+
prompt_id: this.prompt_id,
|
|
305
|
+
auth_type: this.auth_type,
|
|
306
|
+
};
|
|
307
|
+
if (this.error_type) {
|
|
308
|
+
attributes['error.type'] = this.error_type;
|
|
309
|
+
}
|
|
310
|
+
if (typeof this.status_code === 'number') {
|
|
311
|
+
attributes[SemanticAttributes.HTTP_STATUS_CODE] = this.status_code;
|
|
312
|
+
}
|
|
313
|
+
return attributes;
|
|
314
|
+
}
|
|
315
|
+
toLogBody() {
|
|
316
|
+
return `API error for ${this.model}. Error: ${this.error}. Duration: ${this.duration_ms}ms.`;
|
|
317
|
+
}
|
|
186
318
|
}
|
|
319
|
+
export const EVENT_API_RESPONSE = 'gemini_cli.api_response';
|
|
187
320
|
export class ApiResponseEvent {
|
|
188
321
|
'event.name';
|
|
189
322
|
'event.timestamp';
|
|
@@ -215,7 +348,38 @@ export class ApiResponseEvent {
|
|
|
215
348
|
this.prompt_id = prompt_id;
|
|
216
349
|
this.auth_type = auth_type;
|
|
217
350
|
}
|
|
351
|
+
toOpenTelemetryAttributes(config) {
|
|
352
|
+
const attributes = {
|
|
353
|
+
...getCommonAttributes(config),
|
|
354
|
+
'event.name': EVENT_API_RESPONSE,
|
|
355
|
+
'event.timestamp': this['event.timestamp'],
|
|
356
|
+
model: this.model,
|
|
357
|
+
duration_ms: this.duration_ms,
|
|
358
|
+
input_token_count: this.input_token_count,
|
|
359
|
+
output_token_count: this.output_token_count,
|
|
360
|
+
cached_content_token_count: this.cached_content_token_count,
|
|
361
|
+
thoughts_token_count: this.thoughts_token_count,
|
|
362
|
+
tool_token_count: this.tool_token_count,
|
|
363
|
+
total_token_count: this.total_token_count,
|
|
364
|
+
prompt_id: this.prompt_id,
|
|
365
|
+
auth_type: this.auth_type,
|
|
366
|
+
status_code: this.status_code,
|
|
367
|
+
};
|
|
368
|
+
if (this.response_text) {
|
|
369
|
+
attributes['response_text'] = this.response_text;
|
|
370
|
+
}
|
|
371
|
+
if (this.status_code) {
|
|
372
|
+
if (typeof this.status_code === 'number') {
|
|
373
|
+
attributes[SemanticAttributes.HTTP_STATUS_CODE] = this.status_code;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return attributes;
|
|
377
|
+
}
|
|
378
|
+
toLogBody() {
|
|
379
|
+
return `API response from ${this.model}. Status: ${this.status_code || 'N/A'}. Duration: ${this.duration_ms}ms.`;
|
|
380
|
+
}
|
|
218
381
|
}
|
|
382
|
+
export const EVENT_FLASH_FALLBACK = 'gemini_cli.flash_fallback';
|
|
219
383
|
export class FlashFallbackEvent {
|
|
220
384
|
'event.name';
|
|
221
385
|
'event.timestamp';
|
|
@@ -225,7 +389,19 @@ export class FlashFallbackEvent {
|
|
|
225
389
|
this['event.timestamp'] = new Date().toISOString();
|
|
226
390
|
this.auth_type = auth_type;
|
|
227
391
|
}
|
|
392
|
+
toOpenTelemetryAttributes(config) {
|
|
393
|
+
return {
|
|
394
|
+
...getCommonAttributes(config),
|
|
395
|
+
'event.name': EVENT_FLASH_FALLBACK,
|
|
396
|
+
'event.timestamp': this['event.timestamp'],
|
|
397
|
+
auth_type: this.auth_type,
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
toLogBody() {
|
|
401
|
+
return `Switching to flash as Fallback.`;
|
|
402
|
+
}
|
|
228
403
|
}
|
|
404
|
+
export const EVENT_RIPGREP_FALLBACK = 'gemini_cli.ripgrep_fallback';
|
|
229
405
|
export class RipgrepFallbackEvent {
|
|
230
406
|
error;
|
|
231
407
|
'event.name';
|
|
@@ -235,6 +411,17 @@ export class RipgrepFallbackEvent {
|
|
|
235
411
|
this['event.name'] = 'ripgrep_fallback';
|
|
236
412
|
this['event.timestamp'] = new Date().toISOString();
|
|
237
413
|
}
|
|
414
|
+
toOpenTelemetryAttributes(config) {
|
|
415
|
+
return {
|
|
416
|
+
...getCommonAttributes(config),
|
|
417
|
+
'event.name': EVENT_RIPGREP_FALLBACK,
|
|
418
|
+
'event.timestamp': this['event.timestamp'],
|
|
419
|
+
error: this.error,
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
toLogBody() {
|
|
423
|
+
return `Switching to grep as fallback.`;
|
|
424
|
+
}
|
|
238
425
|
}
|
|
239
426
|
export var LoopType;
|
|
240
427
|
(function (LoopType) {
|
|
@@ -253,6 +440,18 @@ export class LoopDetectedEvent {
|
|
|
253
440
|
this.loop_type = loop_type;
|
|
254
441
|
this.prompt_id = prompt_id;
|
|
255
442
|
}
|
|
443
|
+
toOpenTelemetryAttributes(config) {
|
|
444
|
+
return {
|
|
445
|
+
...getCommonAttributes(config),
|
|
446
|
+
'event.name': this['event.name'],
|
|
447
|
+
'event.timestamp': this['event.timestamp'],
|
|
448
|
+
loop_type: this.loop_type,
|
|
449
|
+
prompt_id: this.prompt_id,
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
toLogBody() {
|
|
453
|
+
return `Loop detected. Type: ${this.loop_type}.`;
|
|
454
|
+
}
|
|
256
455
|
}
|
|
257
456
|
export class LoopDetectionDisabledEvent {
|
|
258
457
|
'event.name';
|
|
@@ -263,7 +462,19 @@ export class LoopDetectionDisabledEvent {
|
|
|
263
462
|
this['event.timestamp'] = new Date().toISOString();
|
|
264
463
|
this.prompt_id = prompt_id;
|
|
265
464
|
}
|
|
465
|
+
toOpenTelemetryAttributes(config) {
|
|
466
|
+
return {
|
|
467
|
+
...getCommonAttributes(config),
|
|
468
|
+
'event.name': this['event.name'],
|
|
469
|
+
'event.timestamp': this['event.timestamp'],
|
|
470
|
+
prompt_id: this.prompt_id,
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
toLogBody() {
|
|
474
|
+
return `Loop detection disabled.`;
|
|
475
|
+
}
|
|
266
476
|
}
|
|
477
|
+
export const EVENT_NEXT_SPEAKER_CHECK = 'gemini_cli.next_speaker_check';
|
|
267
478
|
export class NextSpeakerCheckEvent {
|
|
268
479
|
'event.name';
|
|
269
480
|
'event.timestamp';
|
|
@@ -277,7 +488,21 @@ export class NextSpeakerCheckEvent {
|
|
|
277
488
|
this.finish_reason = finish_reason;
|
|
278
489
|
this.result = result;
|
|
279
490
|
}
|
|
491
|
+
toOpenTelemetryAttributes(config) {
|
|
492
|
+
return {
|
|
493
|
+
...getCommonAttributes(config),
|
|
494
|
+
'event.name': EVENT_NEXT_SPEAKER_CHECK,
|
|
495
|
+
'event.timestamp': this['event.timestamp'],
|
|
496
|
+
prompt_id: this.prompt_id,
|
|
497
|
+
finish_reason: this.finish_reason,
|
|
498
|
+
result: this.result,
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
toLogBody() {
|
|
502
|
+
return `Next speaker check.`;
|
|
503
|
+
}
|
|
280
504
|
}
|
|
505
|
+
export const EVENT_SLASH_COMMAND = 'gemini_cli.slash_command';
|
|
281
506
|
export function makeSlashCommandEvent({ command, subcommand, status, }) {
|
|
282
507
|
return {
|
|
283
508
|
'event.name': 'slash_command',
|
|
@@ -285,6 +510,19 @@ export function makeSlashCommandEvent({ command, subcommand, status, }) {
|
|
|
285
510
|
command,
|
|
286
511
|
subcommand,
|
|
287
512
|
status,
|
|
513
|
+
toOpenTelemetryAttributes(config) {
|
|
514
|
+
return {
|
|
515
|
+
...getCommonAttributes(config),
|
|
516
|
+
'event.name': EVENT_SLASH_COMMAND,
|
|
517
|
+
'event.timestamp': this['event.timestamp'],
|
|
518
|
+
command: this.command,
|
|
519
|
+
subcommand: this.subcommand,
|
|
520
|
+
status: this.status,
|
|
521
|
+
};
|
|
522
|
+
},
|
|
523
|
+
toLogBody() {
|
|
524
|
+
return `Slash command: ${this.command}.`;
|
|
525
|
+
},
|
|
288
526
|
};
|
|
289
527
|
}
|
|
290
528
|
export var SlashCommandStatus;
|
|
@@ -292,14 +530,28 @@ export var SlashCommandStatus;
|
|
|
292
530
|
SlashCommandStatus["SUCCESS"] = "success";
|
|
293
531
|
SlashCommandStatus["ERROR"] = "error";
|
|
294
532
|
})(SlashCommandStatus || (SlashCommandStatus = {}));
|
|
533
|
+
export const EVENT_CHAT_COMPRESSION = 'gemini_cli.chat_compression';
|
|
295
534
|
export function makeChatCompressionEvent({ tokens_before, tokens_after, }) {
|
|
296
535
|
return {
|
|
297
536
|
'event.name': 'chat_compression',
|
|
298
537
|
'event.timestamp': new Date().toISOString(),
|
|
299
538
|
tokens_before,
|
|
300
539
|
tokens_after,
|
|
540
|
+
toOpenTelemetryAttributes(config) {
|
|
541
|
+
return {
|
|
542
|
+
...getCommonAttributes(config),
|
|
543
|
+
'event.name': EVENT_CHAT_COMPRESSION,
|
|
544
|
+
'event.timestamp': this['event.timestamp'],
|
|
545
|
+
tokens_before: this.tokens_before,
|
|
546
|
+
tokens_after: this.tokens_after,
|
|
547
|
+
};
|
|
548
|
+
},
|
|
549
|
+
toLogBody() {
|
|
550
|
+
return `Chat compression (Saved ${this.tokens_before - this.tokens_after} tokens)`;
|
|
551
|
+
},
|
|
301
552
|
};
|
|
302
553
|
}
|
|
554
|
+
export const EVENT_MALFORMED_JSON_RESPONSE = 'gemini_cli.malformed_json_response';
|
|
303
555
|
export class MalformedJsonResponseEvent {
|
|
304
556
|
'event.name';
|
|
305
557
|
'event.timestamp';
|
|
@@ -309,12 +561,24 @@ export class MalformedJsonResponseEvent {
|
|
|
309
561
|
this['event.timestamp'] = new Date().toISOString();
|
|
310
562
|
this.model = model;
|
|
311
563
|
}
|
|
564
|
+
toOpenTelemetryAttributes(config) {
|
|
565
|
+
return {
|
|
566
|
+
...getCommonAttributes(config),
|
|
567
|
+
'event.name': EVENT_MALFORMED_JSON_RESPONSE,
|
|
568
|
+
'event.timestamp': this['event.timestamp'],
|
|
569
|
+
model: this.model,
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
toLogBody() {
|
|
573
|
+
return `Malformed JSON response from ${this.model}.`;
|
|
574
|
+
}
|
|
312
575
|
}
|
|
313
576
|
export var IdeConnectionType;
|
|
314
577
|
(function (IdeConnectionType) {
|
|
315
578
|
IdeConnectionType["START"] = "start";
|
|
316
579
|
IdeConnectionType["SESSION"] = "session";
|
|
317
580
|
})(IdeConnectionType || (IdeConnectionType = {}));
|
|
581
|
+
export const EVENT_IDE_CONNECTION = 'gemini_cli.ide_connection';
|
|
318
582
|
export class IdeConnectionEvent {
|
|
319
583
|
'event.name';
|
|
320
584
|
'event.timestamp';
|
|
@@ -324,7 +588,19 @@ export class IdeConnectionEvent {
|
|
|
324
588
|
this['event.timestamp'] = new Date().toISOString();
|
|
325
589
|
this.connection_type = connection_type;
|
|
326
590
|
}
|
|
591
|
+
toOpenTelemetryAttributes(config) {
|
|
592
|
+
return {
|
|
593
|
+
...getCommonAttributes(config),
|
|
594
|
+
'event.name': EVENT_IDE_CONNECTION,
|
|
595
|
+
'event.timestamp': this['event.timestamp'],
|
|
596
|
+
connection_type: this.connection_type,
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
toLogBody() {
|
|
600
|
+
return `Ide connection. Type: ${this.connection_type}.`;
|
|
601
|
+
}
|
|
327
602
|
}
|
|
603
|
+
export const EVENT_CONVERSATION_FINISHED = 'gemini_cli.conversation_finished';
|
|
328
604
|
export class ConversationFinishedEvent {
|
|
329
605
|
'event_name';
|
|
330
606
|
'event.timestamp'; // ISO 8601;
|
|
@@ -336,6 +612,18 @@ export class ConversationFinishedEvent {
|
|
|
336
612
|
this.approvalMode = approvalMode;
|
|
337
613
|
this.turnCount = turnCount;
|
|
338
614
|
}
|
|
615
|
+
toOpenTelemetryAttributes(config) {
|
|
616
|
+
return {
|
|
617
|
+
...getCommonAttributes(config),
|
|
618
|
+
'event.name': EVENT_CONVERSATION_FINISHED,
|
|
619
|
+
'event.timestamp': this['event.timestamp'],
|
|
620
|
+
approvalMode: this.approvalMode,
|
|
621
|
+
turnCount: this.turnCount,
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
toLogBody() {
|
|
625
|
+
return `Conversation finished.`;
|
|
626
|
+
}
|
|
339
627
|
}
|
|
340
628
|
export class KittySequenceOverflowEvent {
|
|
341
629
|
'event.name';
|
|
@@ -349,7 +637,20 @@ export class KittySequenceOverflowEvent {
|
|
|
349
637
|
// Truncate to first 20 chars for logging (avoid logging sensitive data)
|
|
350
638
|
this.truncated_sequence = truncated_sequence.substring(0, 20);
|
|
351
639
|
}
|
|
640
|
+
toOpenTelemetryAttributes(config) {
|
|
641
|
+
return {
|
|
642
|
+
...getCommonAttributes(config),
|
|
643
|
+
'event.name': this['event.name'],
|
|
644
|
+
'event.timestamp': this['event.timestamp'],
|
|
645
|
+
sequence_length: this.sequence_length,
|
|
646
|
+
truncated_sequence: this.truncated_sequence,
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
toLogBody() {
|
|
650
|
+
return `Kitty sequence buffer overflow: ${this.sequence_length} bytes`;
|
|
651
|
+
}
|
|
352
652
|
}
|
|
653
|
+
export const EVENT_FILE_OPERATION = 'gemini_cli.file_operation';
|
|
353
654
|
export class FileOperationEvent {
|
|
354
655
|
'event.name';
|
|
355
656
|
'event.timestamp';
|
|
@@ -369,7 +670,33 @@ export class FileOperationEvent {
|
|
|
369
670
|
this.extension = extension;
|
|
370
671
|
this.programming_language = programming_language;
|
|
371
672
|
}
|
|
673
|
+
toOpenTelemetryAttributes(config) {
|
|
674
|
+
const attributes = {
|
|
675
|
+
...getCommonAttributes(config),
|
|
676
|
+
'event.name': EVENT_FILE_OPERATION,
|
|
677
|
+
'event.timestamp': this['event.timestamp'],
|
|
678
|
+
tool_name: this.tool_name,
|
|
679
|
+
operation: this.operation,
|
|
680
|
+
};
|
|
681
|
+
if (this.lines) {
|
|
682
|
+
attributes['lines'] = this.lines;
|
|
683
|
+
}
|
|
684
|
+
if (this.mimetype) {
|
|
685
|
+
attributes['mimetype'] = this.mimetype;
|
|
686
|
+
}
|
|
687
|
+
if (this.extension) {
|
|
688
|
+
attributes['extension'] = this.extension;
|
|
689
|
+
}
|
|
690
|
+
if (this.programming_language) {
|
|
691
|
+
attributes['programming_language'] = this.programming_language;
|
|
692
|
+
}
|
|
693
|
+
return attributes;
|
|
694
|
+
}
|
|
695
|
+
toLogBody() {
|
|
696
|
+
return `File operation: ${this.operation}. Lines: ${this.lines}.`;
|
|
697
|
+
}
|
|
372
698
|
}
|
|
699
|
+
export const EVENT_INVALID_CHUNK = 'gemini_cli.chat.invalid_chunk';
|
|
373
700
|
// Add these new event interfaces
|
|
374
701
|
export class InvalidChunkEvent {
|
|
375
702
|
'event.name';
|
|
@@ -380,7 +707,22 @@ export class InvalidChunkEvent {
|
|
|
380
707
|
this['event.timestamp'] = new Date().toISOString();
|
|
381
708
|
this.error_message = error_message;
|
|
382
709
|
}
|
|
710
|
+
toOpenTelemetryAttributes(config) {
|
|
711
|
+
const attributes = {
|
|
712
|
+
...getCommonAttributes(config),
|
|
713
|
+
'event.name': EVENT_INVALID_CHUNK,
|
|
714
|
+
'event.timestamp': this['event.timestamp'],
|
|
715
|
+
};
|
|
716
|
+
if (this.error_message) {
|
|
717
|
+
attributes['error.message'] = this.error_message;
|
|
718
|
+
}
|
|
719
|
+
return attributes;
|
|
720
|
+
}
|
|
721
|
+
toLogBody() {
|
|
722
|
+
return `Invalid chunk received from stream.`;
|
|
723
|
+
}
|
|
383
724
|
}
|
|
725
|
+
export const EVENT_CONTENT_RETRY = 'gemini_cli.chat.content_retry';
|
|
384
726
|
export class ContentRetryEvent {
|
|
385
727
|
'event.name';
|
|
386
728
|
'event.timestamp';
|
|
@@ -396,7 +738,22 @@ export class ContentRetryEvent {
|
|
|
396
738
|
this.retry_delay_ms = retry_delay_ms;
|
|
397
739
|
this.model = model;
|
|
398
740
|
}
|
|
741
|
+
toOpenTelemetryAttributes(config) {
|
|
742
|
+
return {
|
|
743
|
+
...getCommonAttributes(config),
|
|
744
|
+
'event.name': EVENT_CONTENT_RETRY,
|
|
745
|
+
'event.timestamp': this['event.timestamp'],
|
|
746
|
+
attempt_number: this.attempt_number,
|
|
747
|
+
error_type: this.error_type,
|
|
748
|
+
retry_delay_ms: this.retry_delay_ms,
|
|
749
|
+
model: this.model,
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
toLogBody() {
|
|
753
|
+
return `Content retry attempt ${this.attempt_number} due to ${this.error_type}.`;
|
|
754
|
+
}
|
|
399
755
|
}
|
|
756
|
+
export const EVENT_CONTENT_RETRY_FAILURE = 'gemini_cli.chat.content_retry_failure';
|
|
400
757
|
export class ContentRetryFailureEvent {
|
|
401
758
|
'event.name';
|
|
402
759
|
'event.timestamp';
|
|
@@ -412,7 +769,22 @@ export class ContentRetryFailureEvent {
|
|
|
412
769
|
this.total_duration_ms = total_duration_ms;
|
|
413
770
|
this.model = model;
|
|
414
771
|
}
|
|
772
|
+
toOpenTelemetryAttributes(config) {
|
|
773
|
+
return {
|
|
774
|
+
...getCommonAttributes(config),
|
|
775
|
+
'event.name': EVENT_CONTENT_RETRY_FAILURE,
|
|
776
|
+
'event.timestamp': this['event.timestamp'],
|
|
777
|
+
total_attempts: this.total_attempts,
|
|
778
|
+
final_error_type: this.final_error_type,
|
|
779
|
+
total_duration_ms: this.total_duration_ms,
|
|
780
|
+
model: this.model,
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
toLogBody() {
|
|
784
|
+
return `All content retries failed after ${this.total_attempts} attempts.`;
|
|
785
|
+
}
|
|
415
786
|
}
|
|
787
|
+
export const EVENT_MODEL_ROUTING = 'gemini_cli.model_routing';
|
|
416
788
|
export class ModelRoutingEvent {
|
|
417
789
|
'event.name';
|
|
418
790
|
'event.timestamp';
|
|
@@ -432,7 +804,24 @@ export class ModelRoutingEvent {
|
|
|
432
804
|
this.failed = failed;
|
|
433
805
|
this.error_message = error_message;
|
|
434
806
|
}
|
|
807
|
+
toOpenTelemetryAttributes(config) {
|
|
808
|
+
return {
|
|
809
|
+
...getCommonAttributes(config),
|
|
810
|
+
'event.name': EVENT_MODEL_ROUTING,
|
|
811
|
+
'event.timestamp': this['event.timestamp'],
|
|
812
|
+
decision_model: this.decision_model,
|
|
813
|
+
decision_source: this.decision_source,
|
|
814
|
+
routing_latency_ms: this.routing_latency_ms,
|
|
815
|
+
reasoning: this.reasoning,
|
|
816
|
+
failed: this.failed,
|
|
817
|
+
error_message: this.error_message,
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
toLogBody() {
|
|
821
|
+
return `Model routing decision. Model: ${this.decision_model}, Source: ${this.decision_source}`;
|
|
822
|
+
}
|
|
435
823
|
}
|
|
824
|
+
export const EVENT_EXTENSION_INSTALL = 'gemini_cli.extension_install';
|
|
436
825
|
export class ExtensionInstallEvent {
|
|
437
826
|
'event.name';
|
|
438
827
|
'event.timestamp';
|
|
@@ -448,7 +837,22 @@ export class ExtensionInstallEvent {
|
|
|
448
837
|
this.extension_source = extension_source;
|
|
449
838
|
this.status = status;
|
|
450
839
|
}
|
|
840
|
+
toOpenTelemetryAttributes(config) {
|
|
841
|
+
return {
|
|
842
|
+
...getCommonAttributes(config),
|
|
843
|
+
'event.name': EVENT_EXTENSION_INSTALL,
|
|
844
|
+
'event.timestamp': this['event.timestamp'],
|
|
845
|
+
extension_name: this.extension_name,
|
|
846
|
+
extension_version: this.extension_version,
|
|
847
|
+
extension_source: this.extension_source,
|
|
848
|
+
status: this.status,
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
toLogBody() {
|
|
852
|
+
return `Installed extension ${this.extension_name}`;
|
|
853
|
+
}
|
|
451
854
|
}
|
|
855
|
+
export const EVENT_TOOL_OUTPUT_TRUNCATED = 'gemini_cli.tool_output_truncated';
|
|
452
856
|
export class ToolOutputTruncatedEvent {
|
|
453
857
|
eventName = 'tool_output_truncated';
|
|
454
858
|
'event.timestamp' = new Date().toISOString();
|
|
@@ -468,7 +872,25 @@ export class ToolOutputTruncatedEvent {
|
|
|
468
872
|
this.threshold = details.threshold;
|
|
469
873
|
this.lines = details.lines;
|
|
470
874
|
}
|
|
875
|
+
toOpenTelemetryAttributes(config) {
|
|
876
|
+
return {
|
|
877
|
+
...getCommonAttributes(config),
|
|
878
|
+
'event.name': EVENT_TOOL_OUTPUT_TRUNCATED,
|
|
879
|
+
eventName: this.eventName,
|
|
880
|
+
'event.timestamp': this['event.timestamp'],
|
|
881
|
+
tool_name: this.tool_name,
|
|
882
|
+
original_content_length: this.original_content_length,
|
|
883
|
+
truncated_content_length: this.truncated_content_length,
|
|
884
|
+
threshold: this.threshold,
|
|
885
|
+
lines: this.lines,
|
|
886
|
+
prompt_id: this.prompt_id,
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
toLogBody() {
|
|
890
|
+
return `Tool output truncated for ${this.tool_name}.`;
|
|
891
|
+
}
|
|
471
892
|
}
|
|
893
|
+
export const EVENT_EXTENSION_UNINSTALL = 'gemini_cli.extension_uninstall';
|
|
472
894
|
export class ExtensionUninstallEvent {
|
|
473
895
|
'event.name';
|
|
474
896
|
'event.timestamp';
|
|
@@ -480,7 +902,20 @@ export class ExtensionUninstallEvent {
|
|
|
480
902
|
this.extension_name = extension_name;
|
|
481
903
|
this.status = status;
|
|
482
904
|
}
|
|
905
|
+
toOpenTelemetryAttributes(config) {
|
|
906
|
+
return {
|
|
907
|
+
...getCommonAttributes(config),
|
|
908
|
+
'event.name': EVENT_EXTENSION_UNINSTALL,
|
|
909
|
+
'event.timestamp': this['event.timestamp'],
|
|
910
|
+
extension_name: this.extension_name,
|
|
911
|
+
status: this.status,
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
toLogBody() {
|
|
915
|
+
return `Uninstalled extension ${this.extension_name}`;
|
|
916
|
+
}
|
|
483
917
|
}
|
|
918
|
+
export const EVENT_EXTENSION_ENABLE = 'gemini_cli.extension_enable';
|
|
484
919
|
export class ExtensionEnableEvent {
|
|
485
920
|
'event.name';
|
|
486
921
|
'event.timestamp';
|
|
@@ -492,7 +927,20 @@ export class ExtensionEnableEvent {
|
|
|
492
927
|
this.extension_name = extension_name;
|
|
493
928
|
this.setting_scope = settingScope;
|
|
494
929
|
}
|
|
930
|
+
toOpenTelemetryAttributes(config) {
|
|
931
|
+
return {
|
|
932
|
+
...getCommonAttributes(config),
|
|
933
|
+
'event.name': EVENT_EXTENSION_ENABLE,
|
|
934
|
+
'event.timestamp': this['event.timestamp'],
|
|
935
|
+
extension_name: this.extension_name,
|
|
936
|
+
setting_scope: this.setting_scope,
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
toLogBody() {
|
|
940
|
+
return `Enabled extension ${this.extension_name}`;
|
|
941
|
+
}
|
|
495
942
|
}
|
|
943
|
+
export const EVENT_MODEL_SLASH_COMMAND = 'gemini_cli.slash_command.model';
|
|
496
944
|
export class ModelSlashCommandEvent {
|
|
497
945
|
'event.name';
|
|
498
946
|
'event.timestamp';
|
|
@@ -502,7 +950,19 @@ export class ModelSlashCommandEvent {
|
|
|
502
950
|
this['event.timestamp'] = new Date().toISOString();
|
|
503
951
|
this.model_name = model_name;
|
|
504
952
|
}
|
|
953
|
+
toOpenTelemetryAttributes(config) {
|
|
954
|
+
return {
|
|
955
|
+
...getCommonAttributes(config),
|
|
956
|
+
'event.name': EVENT_MODEL_SLASH_COMMAND,
|
|
957
|
+
'event.timestamp': this['event.timestamp'],
|
|
958
|
+
model_name: this.model_name,
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
toLogBody() {
|
|
962
|
+
return `Model slash command. Model: ${this.model_name}`;
|
|
963
|
+
}
|
|
505
964
|
}
|
|
965
|
+
export const EVENT_EXTENSION_DISABLE = 'gemini_cli.extension_disable';
|
|
506
966
|
export class ExtensionDisableEvent {
|
|
507
967
|
'event.name';
|
|
508
968
|
'event.timestamp';
|
|
@@ -514,7 +974,20 @@ export class ExtensionDisableEvent {
|
|
|
514
974
|
this.extension_name = extension_name;
|
|
515
975
|
this.setting_scope = settingScope;
|
|
516
976
|
}
|
|
977
|
+
toOpenTelemetryAttributes(config) {
|
|
978
|
+
return {
|
|
979
|
+
...getCommonAttributes(config),
|
|
980
|
+
'event.name': EVENT_EXTENSION_DISABLE,
|
|
981
|
+
'event.timestamp': this['event.timestamp'],
|
|
982
|
+
extension_name: this.extension_name,
|
|
983
|
+
setting_scope: this.setting_scope,
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
toLogBody() {
|
|
987
|
+
return `Disabled extension ${this.extension_name}`;
|
|
988
|
+
}
|
|
517
989
|
}
|
|
990
|
+
export const EVENT_SMART_EDIT_STRATEGY = 'gemini_cli.smart_edit_strategy';
|
|
518
991
|
export class SmartEditStrategyEvent {
|
|
519
992
|
'event.name';
|
|
520
993
|
'event.timestamp';
|
|
@@ -524,7 +997,19 @@ export class SmartEditStrategyEvent {
|
|
|
524
997
|
this['event.timestamp'] = new Date().toISOString();
|
|
525
998
|
this.strategy = strategy;
|
|
526
999
|
}
|
|
1000
|
+
toOpenTelemetryAttributes(config) {
|
|
1001
|
+
return {
|
|
1002
|
+
...getCommonAttributes(config),
|
|
1003
|
+
'event.name': EVENT_SMART_EDIT_STRATEGY,
|
|
1004
|
+
'event.timestamp': this['event.timestamp'],
|
|
1005
|
+
strategy: this.strategy,
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
toLogBody() {
|
|
1009
|
+
return `Smart Edit Tool Strategy: ${this.strategy}`;
|
|
1010
|
+
}
|
|
527
1011
|
}
|
|
1012
|
+
export const EVENT_SMART_EDIT_CORRECTION = 'gemini_cli.smart_edit_correction';
|
|
528
1013
|
export class SmartEditCorrectionEvent {
|
|
529
1014
|
'event.name';
|
|
530
1015
|
'event.timestamp';
|
|
@@ -534,7 +1019,19 @@ export class SmartEditCorrectionEvent {
|
|
|
534
1019
|
this['event.timestamp'] = new Date().toISOString();
|
|
535
1020
|
this.correction = correction;
|
|
536
1021
|
}
|
|
1022
|
+
toOpenTelemetryAttributes(config) {
|
|
1023
|
+
return {
|
|
1024
|
+
...getCommonAttributes(config),
|
|
1025
|
+
'event.name': EVENT_SMART_EDIT_CORRECTION,
|
|
1026
|
+
'event.timestamp': this['event.timestamp'],
|
|
1027
|
+
correction: this.correction,
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
toLogBody() {
|
|
1031
|
+
return `Smart Edit Tool Correction: ${this.correction}`;
|
|
1032
|
+
}
|
|
537
1033
|
}
|
|
1034
|
+
export const EVENT_AGENT_START = 'gemini_cli.agent.start';
|
|
538
1035
|
export class AgentStartEvent {
|
|
539
1036
|
'event.name';
|
|
540
1037
|
'event.timestamp';
|
|
@@ -546,7 +1043,20 @@ export class AgentStartEvent {
|
|
|
546
1043
|
this.agent_id = agent_id;
|
|
547
1044
|
this.agent_name = agent_name;
|
|
548
1045
|
}
|
|
1046
|
+
toOpenTelemetryAttributes(config) {
|
|
1047
|
+
return {
|
|
1048
|
+
...getCommonAttributes(config),
|
|
1049
|
+
'event.name': EVENT_AGENT_START,
|
|
1050
|
+
'event.timestamp': this['event.timestamp'],
|
|
1051
|
+
agent_id: this.agent_id,
|
|
1052
|
+
agent_name: this.agent_name,
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
toLogBody() {
|
|
1056
|
+
return `Agent ${this.agent_name} started. ID: ${this.agent_id}`;
|
|
1057
|
+
}
|
|
549
1058
|
}
|
|
1059
|
+
export const EVENT_AGENT_FINISH = 'gemini_cli.agent.finish';
|
|
550
1060
|
export class AgentFinishEvent {
|
|
551
1061
|
'event.name';
|
|
552
1062
|
'event.timestamp';
|
|
@@ -564,7 +1074,23 @@ export class AgentFinishEvent {
|
|
|
564
1074
|
this.turn_count = turn_count;
|
|
565
1075
|
this.terminate_reason = terminate_reason;
|
|
566
1076
|
}
|
|
1077
|
+
toOpenTelemetryAttributes(config) {
|
|
1078
|
+
return {
|
|
1079
|
+
...getCommonAttributes(config),
|
|
1080
|
+
'event.name': EVENT_AGENT_FINISH,
|
|
1081
|
+
'event.timestamp': this['event.timestamp'],
|
|
1082
|
+
agent_id: this.agent_id,
|
|
1083
|
+
agent_name: this.agent_name,
|
|
1084
|
+
duration_ms: this.duration_ms,
|
|
1085
|
+
turn_count: this.turn_count,
|
|
1086
|
+
terminate_reason: this.terminate_reason,
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
toLogBody() {
|
|
1090
|
+
return `Agent ${this.agent_name} finished. Reason: ${this.terminate_reason}. Duration: ${this.duration_ms}ms. Turns: ${this.turn_count}.`;
|
|
1091
|
+
}
|
|
567
1092
|
}
|
|
1093
|
+
export const EVENT_WEB_FETCH_FALLBACK_ATTEMPT = 'gemini_cli.web_fetch_fallback_attempt';
|
|
568
1094
|
export class WebFetchFallbackAttemptEvent {
|
|
569
1095
|
'event.name';
|
|
570
1096
|
'event.timestamp';
|
|
@@ -574,5 +1100,16 @@ export class WebFetchFallbackAttemptEvent {
|
|
|
574
1100
|
this['event.timestamp'] = new Date().toISOString();
|
|
575
1101
|
this.reason = reason;
|
|
576
1102
|
}
|
|
1103
|
+
toOpenTelemetryAttributes(config) {
|
|
1104
|
+
return {
|
|
1105
|
+
...getCommonAttributes(config),
|
|
1106
|
+
'event.name': EVENT_WEB_FETCH_FALLBACK_ATTEMPT,
|
|
1107
|
+
'event.timestamp': this['event.timestamp'],
|
|
1108
|
+
reason: this.reason,
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
toLogBody() {
|
|
1112
|
+
return `Web fetch fallback attempt. Reason: ${this.reason}`;
|
|
1113
|
+
}
|
|
577
1114
|
}
|
|
578
1115
|
//# sourceMappingURL=types.js.map
|