@terminai/core 0.26.0 → 0.50.0

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.
Files changed (97) hide show
  1. package/LICENSE +247 -0
  2. package/README.md +422 -0
  3. package/dist/docs/CONTRIBUTING.md +8 -8
  4. package/dist/docs/changelogs/index.md +5 -5
  5. package/dist/docs/cli/commands.md +43 -17
  6. package/dist/docs/cli/quick-reference.md +61 -0
  7. package/dist/docs/cli/telemetry.md +3 -792
  8. package/dist/docs/extensions/index.md +1 -1
  9. package/dist/docs/get-started/configuration.md +6 -2
  10. package/dist/docs/index.md +17 -17
  11. package/dist/docs/{termai-comparison.md → terminai-comparison.md} +18 -18
  12. package/dist/docs/{termai-examples.md → terminai-examples.md} +2 -2
  13. package/dist/docs/{termai-operator-recipes.md → terminai-operator-recipes.md} +1 -1
  14. package/dist/docs/{termai-process-manager.md → terminai-process-manager.md} +7 -7
  15. package/dist/docs/{termai-quickstart.md → terminai-quickstart.md} +10 -10
  16. package/dist/docs/{termai-system.md → terminai-system.md} +2 -2
  17. package/dist/index.d.ts +0 -1
  18. package/dist/index.js +0 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/src/auth/wizardSettings.js +3 -0
  21. package/dist/src/auth/wizardSettings.js.map +1 -1
  22. package/dist/src/auth/wizardSettings.test.js +3 -0
  23. package/dist/src/auth/wizardSettings.test.js.map +1 -1
  24. package/dist/src/brain/__tests__/advisors.test.js +25 -6
  25. package/dist/src/brain/__tests__/advisors.test.js.map +1 -1
  26. package/dist/src/brain/__tests__/cognitiveArchitecture.test.js +24 -0
  27. package/dist/src/brain/__tests__/cognitiveArchitecture.test.js.map +1 -1
  28. package/dist/src/brain/__tests__/thinkingOrchestrator.test.js +29 -5
  29. package/dist/src/brain/__tests__/thinkingOrchestrator.test.js.map +1 -1
  30. package/dist/src/config/builder.js +4 -1
  31. package/dist/src/config/builder.js.map +1 -1
  32. package/dist/src/config/settings/loader.d.ts +1 -0
  33. package/dist/src/config/settings/loader.js +10 -0
  34. package/dist/src/config/settings/loader.js.map +1 -1
  35. package/dist/src/config/settings/schema.d.ts +2 -5
  36. package/dist/src/config/settings/schema.js +2 -3
  37. package/dist/src/config/settings/schema.js.map +1 -1
  38. package/dist/src/core/client.test.js +0 -2
  39. package/dist/src/core/client.test.js.map +1 -1
  40. package/dist/src/core/coreToolScheduler.test.js +1 -1
  41. package/dist/src/core/coreToolScheduler.test.js.map +1 -1
  42. package/dist/src/generated/git-commit.d.ts +2 -2
  43. package/dist/src/generated/git-commit.js +2 -2
  44. package/dist/src/generated/git-commit.js.map +1 -1
  45. package/dist/src/mcp/token-storage/hybrid-token-storage.d.ts +3 -0
  46. package/dist/src/mcp/token-storage/hybrid-token-storage.js +34 -13
  47. package/dist/src/mcp/token-storage/hybrid-token-storage.js.map +1 -1
  48. package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +25 -0
  49. package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +1 -1
  50. package/dist/src/openai_chatgpt/imports.test.js +17 -1
  51. package/dist/src/openai_chatgpt/imports.test.js.map +1 -1
  52. package/dist/src/telemetry/config.d.ts +1 -0
  53. package/dist/src/telemetry/config.js +3 -4
  54. package/dist/src/telemetry/config.js.map +1 -1
  55. package/dist/src/telemetry/config.test.js +6 -4
  56. package/dist/src/telemetry/config.test.js.map +1 -1
  57. package/dist/src/telemetry/index.d.ts +0 -2
  58. package/dist/src/telemetry/index.js +0 -2
  59. package/dist/src/telemetry/index.js.map +1 -1
  60. package/dist/src/telemetry/loggers.js +0 -36
  61. package/dist/src/telemetry/loggers.js.map +1 -1
  62. package/dist/src/telemetry/loggers.test.js +17 -1
  63. package/dist/src/telemetry/loggers.test.js.map +1 -1
  64. package/dist/src/telemetry/sdk.js +24 -19
  65. package/dist/src/telemetry/sdk.js.map +1 -1
  66. package/dist/src/telemetry/sdk.test.js +17 -135
  67. package/dist/src/telemetry/sdk.test.js.map +1 -1
  68. package/dist/src/tools/confirmation-policy.test.js +1 -1
  69. package/dist/src/tools/confirmation-policy.test.js.map +1 -1
  70. package/dist/src/utils/paths.js +7 -3
  71. package/dist/src/utils/paths.js.map +1 -1
  72. package/dist/src/utils/paths.test.js +31 -2
  73. package/dist/src/utils/paths.test.js.map +1 -1
  74. package/dist/src/utils/shell-permissions.test.js +4 -2
  75. package/dist/src/utils/shell-permissions.test.js.map +1 -1
  76. package/dist/src/utils/shell-utils.test.js +4 -2
  77. package/dist/src/utils/shell-utils.test.js.map +1 -1
  78. package/dist/tsconfig.tsbuildinfo +1 -1
  79. package/package.json +1 -5
  80. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +0 -159
  81. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +0 -1210
  82. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +0 -1
  83. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +0 -20
  84. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +0 -835
  85. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +0 -1
  86. package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +0 -140
  87. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +0 -350
  88. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +0 -1
  89. package/dist/src/telemetry/gcp-exporters.d.ts +0 -36
  90. package/dist/src/telemetry/gcp-exporters.js +0 -121
  91. package/dist/src/telemetry/gcp-exporters.js.map +0 -1
  92. package/dist/src/telemetry/gcp-exporters.test.d.ts +0 -7
  93. package/dist/src/telemetry/gcp-exporters.test.js +0 -319
  94. package/dist/src/telemetry/gcp-exporters.test.js.map +0 -1
  95. package/dist/src/telemetry/integration.test.circular.d.ts +0 -7
  96. package/dist/src/telemetry/integration.test.circular.js +0 -55
  97. package/dist/src/telemetry/integration.test.circular.js.map +0 -1
@@ -1,793 +1,4 @@
1
- # Observability with OpenTelemetry
1
+ # Telemetry
2
2
 
3
- Learn how to enable and setup OpenTelemetry for Gemini CLI.
4
-
5
- - [Observability with OpenTelemetry](#observability-with-opentelemetry)
6
- - [Key benefits](#key-benefits)
7
- - [OpenTelemetry integration](#opentelemetry-integration)
8
- - [Configuration](#configuration)
9
- - [Google Cloud telemetry](#google-cloud-telemetry)
10
- - [Prerequisites](#prerequisites)
11
- - [Direct export (recommended)](#direct-export-recommended)
12
- - [Collector-based export (advanced)](#collector-based-export-advanced)
13
- - [Local telemetry](#local-telemetry)
14
- - [File-based output (recommended)](#file-based-output-recommended)
15
- - [Collector-based export (advanced)](#collector-based-export-advanced-1)
16
- - [Logs and metrics](#logs-and-metrics)
17
- - [Logs](#logs)
18
- - [Sessions](#sessions)
19
- - [Tools](#tools)
20
- - [Files](#files)
21
- - [API](#api)
22
- - [Model routing](#model-routing)
23
- - [Chat and streaming](#chat-and-streaming)
24
- - [Resilience](#resilience)
25
- - [Extensions](#extensions)
26
- - [Agent runs](#agent-runs)
27
- - [IDE](#ide)
28
- - [UI](#ui)
29
- - [Metrics](#metrics)
30
- - [Custom](#custom)
31
- - [Sessions](#sessions-1)
32
- - [Tools](#tools-1)
33
- - [API](#api-1)
34
- - [Token usage](#token-usage)
35
- - [Files](#files-1)
36
- - [Chat and streaming](#chat-and-streaming-1)
37
- - [Model routing](#model-routing-1)
38
- - [Agent runs](#agent-runs-1)
39
- - [UI](#ui-1)
40
- - [Performance](#performance)
41
- - [GenAI semantic convention](#genai-semantic-convention)
42
-
43
- ## Key benefits
44
-
45
- - **🔍 Usage analytics**: Understand interaction patterns and feature adoption
46
- across your team
47
- - **⚡ Performance monitoring**: Track response times, token consumption, and
48
- resource utilization
49
- - **🐛 Real-time debugging**: Identify bottlenecks, failures, and error patterns
50
- as they occur
51
- - **📊 Workflow optimization**: Make informed decisions to improve
52
- configurations and processes
53
- - **🏢 Enterprise governance**: Monitor usage across teams, track costs, ensure
54
- compliance, and integrate with existing monitoring infrastructure
55
-
56
- ## OpenTelemetry integration
57
-
58
- Built on **[OpenTelemetry]** — the vendor-neutral, industry-standard
59
- observability framework — Gemini CLI's observability system provides:
60
-
61
- - **Universal compatibility**: Export to any OpenTelemetry backend (Google
62
- Cloud, Jaeger, Prometheus, Datadog, etc.)
63
- - **Standardized data**: Use consistent formats and collection methods across
64
- your toolchain
65
- - **Future-proof integration**: Connect with existing and future observability
66
- infrastructure
67
- - **No vendor lock-in**: Switch between backends without changing your
68
- instrumentation
69
-
70
- [OpenTelemetry]: https://opentelemetry.io/
71
-
72
- ## Configuration
73
-
74
- All telemetry behavior is controlled through your `.terminai/settings.json`
75
- file. Environment variables can be used to override the settings in the file.
76
-
77
- | Setting | Environment Variable | Description | Values | Default |
78
- | -------------- | ---------------------------------- | --------------------------------------------------- | ----------------- | ----------------------- |
79
- | `enabled` | `TERMINAI_TELEMETRY_ENABLED` | Enable or disable telemetry | `true`/`false` | `false` |
80
- | `target` | `TERMINAI_TELEMETRY_TARGET` | Where to send telemetry data | `"gcp"`/`"local"` | `"local"` |
81
- | `otlpEndpoint` | `TERMINAI_TELEMETRY_OTLP_ENDPOINT` | OTLP collector endpoint | URL string | `http://localhost:4317` |
82
- | `otlpProtocol` | `TERMINAI_TELEMETRY_OTLP_PROTOCOL` | OTLP transport protocol | `"grpc"`/`"http"` | `"grpc"` |
83
- | `outfile` | `TERMINAI_TELEMETRY_OUTFILE` | Save telemetry to file (overrides `otlpEndpoint`) | file path | - |
84
- | `logPrompts` | `TERMINAI_TELEMETRY_LOG_PROMPTS` | Include prompts in telemetry logs | `true`/`false` | `true` |
85
- | `useCollector` | `TERMINAI_TELEMETRY_USE_COLLECTOR` | Use external OTLP collector (advanced) | `true`/`false` | `false` |
86
- | `useCliAuth` | `TERMINAI_TELEMETRY_USE_CLI_AUTH` | Use CLI credentials for telemetry (GCP target only) | `true`/`false` | `false` |
87
-
88
- **Note on boolean environment variables:** For the boolean settings (`enabled`,
89
- `logPrompts`, `useCollector`), setting the corresponding environment variable to
90
- `true` or `1` will enable the feature. Any other value will disable it.
91
-
92
- For detailed information about all configuration options, see the
93
- [Configuration guide](../get-started/configuration.md).
94
-
95
- ## Google Cloud telemetry
96
-
97
- ### Prerequisites
98
-
99
- Before using either method below, complete these steps:
100
-
101
- 1. Set your Google Cloud project ID:
102
- - For telemetry in a separate project from inference:
103
- ```bash
104
- export OTLP_GOOGLE_CLOUD_PROJECT="your-telemetry-project-id"
105
- ```
106
- - For telemetry in the same project as inference:
107
- ```bash
108
- export GOOGLE_CLOUD_PROJECT="your-project-id"
109
- ```
110
-
111
- 2. Authenticate with Google Cloud:
112
- - If using a user account:
113
- ```bash
114
- gcloud auth application-default login
115
- ```
116
- - If using a service account:
117
- ```bash
118
- export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account.json"
119
- ```
120
- 3. Make sure your account or service account has these IAM roles:
121
- - Cloud Trace Agent
122
- - Monitoring Metric Writer
123
- - Logs Writer
124
-
125
- 4. Enable the required Google Cloud APIs (if not already enabled):
126
- ```bash
127
- gcloud services enable \
128
- cloudtrace.googleapis.com \
129
- monitoring.googleapis.com \
130
- logging.googleapis.com \
131
- --project="$OTLP_GOOGLE_CLOUD_PROJECT"
132
- ```
133
-
134
- ### Authenticating with CLI Credentials
135
-
136
- By default, the telemetry collector for Google Cloud uses Application Default
137
- Credentials (ADC). However, you can configure it to use the same OAuth
138
- credentials that you use to log in to the Gemini CLI. This is useful in
139
- environments where you don't have ADC set up.
140
-
141
- To enable this, set the `useCliAuth` property in your `telemetry` settings to
142
- `true`:
143
-
144
- ```json
145
- {
146
- "telemetry": {
147
- "enabled": true,
148
- "target": "gcp",
149
- "useCliAuth": true
150
- }
151
- }
152
- ```
153
-
154
- **Important:**
155
-
156
- - This setting requires the use of **Direct Export** (in-process exporters).
157
- - It **cannot** be used with `useCollector: true`. If you enable both, telemetry
158
- will be disabled and an error will be logged.
159
- - The CLI will automatically use your credentials to authenticate with Google
160
- Cloud Trace, Metrics, and Logging APIs.
161
-
162
- ### Direct export (recommended)
163
-
164
- Sends telemetry directly to Google Cloud services. No collector needed.
165
-
166
- 1. Enable telemetry in your `.terminai/settings.json`:
167
- ```json
168
- {
169
- "telemetry": {
170
- "enabled": true,
171
- "target": "gcp"
172
- }
173
- }
174
- ```
175
- 2. Run Gemini CLI and send prompts.
176
- 3. View logs and metrics:
177
- - Open the Google Cloud Console in your browser after sending prompts:
178
- - Logs: https://console.cloud.google.com/logs/
179
- - Metrics: https://console.cloud.google.com/monitoring/metrics-explorer
180
- - Traces: https://console.cloud.google.com/traces/list
181
-
182
- ### Collector-based export (advanced)
183
-
184
- For custom processing, filtering, or routing, use an OpenTelemetry collector to
185
- forward data to Google Cloud.
186
-
187
- 1. Configure your `.terminai/settings.json`:
188
- ```json
189
- {
190
- "telemetry": {
191
- "enabled": true,
192
- "target": "gcp",
193
- "useCollector": true
194
- }
195
- }
196
- ```
197
- 2. Run the automation script:
198
- ```bash
199
- npm run telemetry -- --target=gcp
200
- ```
201
- This will:
202
- - Start a local OTEL collector that forwards to Google Cloud
203
- - Configure your workspace
204
- - Provide links to view traces, metrics, and logs in Google Cloud Console
205
- - Save collector logs to
206
- `~/.terminai/tmp/<projectHash>/otel/collector-gcp.log`
207
- - Stop collector on exit (e.g. `Ctrl+C`)
208
- 3. Run Gemini CLI and send prompts.
209
- 4. View logs and metrics:
210
- - Open the Google Cloud Console in your browser after sending prompts:
211
- - Logs: https://console.cloud.google.com/logs/
212
- - Metrics: https://console.cloud.google.com/monitoring/metrics-explorer
213
- - Traces: https://console.cloud.google.com/traces/list
214
- - Open `~/.terminai/tmp/<projectHash>/otel/collector-gcp.log` to view local
215
- collector logs.
216
-
217
- ## Local telemetry
218
-
219
- For local development and debugging, you can capture telemetry data locally:
220
-
221
- ### File-based output (recommended)
222
-
223
- 1. Enable telemetry in your `.terminai/settings.json`:
224
- ```json
225
- {
226
- "telemetry": {
227
- "enabled": true,
228
- "target": "local",
229
- "otlpEndpoint": "",
230
- "outfile": ".terminai/telemetry.log"
231
- }
232
- }
233
- ```
234
- 2. Run Gemini CLI and send prompts.
235
- 3. View logs and metrics in the specified file (e.g.,
236
- `.terminai/telemetry.log`).
237
-
238
- ### Collector-based export (advanced)
239
-
240
- 1. Run the automation script:
241
- ```bash
242
- npm run telemetry -- --target=local
243
- ```
244
- This will:
245
- - Download and start Jaeger and OTEL collector
246
- - Configure your workspace for local telemetry
247
- - Provide a Jaeger UI at http://localhost:16686
248
- - Save logs/metrics to `~/.terminai/tmp/<projectHash>/otel/collector.log`
249
- - Stop collector on exit (e.g. `Ctrl+C`)
250
- 2. Run Gemini CLI and send prompts.
251
- 3. View traces at http://localhost:16686 and logs/metrics in the collector log
252
- file.
253
-
254
- ## Logs and metrics
255
-
256
- The following section describes the structure of logs and metrics generated for
257
- Gemini CLI.
258
-
259
- The `session.id`, `installation.id`, and `user.email` (available only when
260
- authenticated with a Google account) are included as common attributes on all
261
- logs and metrics.
262
-
263
- ### Logs
264
-
265
- Logs are timestamped records of specific events. The following events are logged
266
- for Gemini CLI, grouped by category.
267
-
268
- #### Sessions
269
-
270
- Captures startup configuration and user prompt submissions.
271
-
272
- - `gemini_cli.config`: Emitted once at startup with the CLI configuration.
273
- - **Attributes**:
274
- - `model` (string)
275
- - `embedding_model` (string)
276
- - `sandbox_enabled` (boolean)
277
- - `core_tools_enabled` (string)
278
- - `approval_mode` (string)
279
- - `api_key_enabled` (boolean)
280
- - `vertex_ai_enabled` (boolean)
281
- - `log_user_prompts_enabled` (boolean)
282
- - `file_filtering_respect_git_ignore` (boolean)
283
- - `debug_mode` (boolean)
284
- - `mcp_servers` (string)
285
- - `mcp_servers_count` (int)
286
- - `extensions` (string)
287
- - `extension_ids` (string)
288
- - `extension_count` (int)
289
- - `mcp_tools` (string, if applicable)
290
- - `mcp_tools_count` (int, if applicable)
291
- - `output_format` ("text", "json", or "stream-json")
292
-
293
- - `gemini_cli.user_prompt`: Emitted when a user submits a prompt.
294
- - **Attributes**:
295
- - `prompt_length` (int)
296
- - `prompt_id` (string)
297
- - `prompt` (string; excluded if `telemetry.logPrompts` is `false`)
298
- - `auth_type` (string)
299
-
300
- #### Tools
301
-
302
- Captures tool executions, output truncation, and Smart Edit behavior.
303
-
304
- - `gemini_cli.tool_call`: Emitted for each tool (function) call.
305
- - **Attributes**:
306
- - `function_name`
307
- - `function_args`
308
- - `duration_ms`
309
- - `success` (boolean)
310
- - `decision` ("accept", "reject", "auto_accept", or "modify", if applicable)
311
- - `error` (if applicable)
312
- - `error_type` (if applicable)
313
- - `prompt_id` (string)
314
- - `tool_type` ("native" or "mcp")
315
- - `mcp_server_name` (string, if applicable)
316
- - `extension_name` (string, if applicable)
317
- - `extension_id` (string, if applicable)
318
- - `content_length` (int, if applicable)
319
- - `metadata` (if applicable)
320
-
321
- - `gemini_cli.tool_output_truncated`: Output of a tool call was truncated.
322
- - **Attributes**:
323
- - `tool_name` (string)
324
- - `original_content_length` (int)
325
- - `truncated_content_length` (int)
326
- - `threshold` (int)
327
- - `lines` (int)
328
- - `prompt_id` (string)
329
-
330
- - `gemini_cli.smart_edit_strategy`: Smart Edit strategy chosen.
331
- - **Attributes**:
332
- - `strategy` (string)
333
-
334
- - `gemini_cli.smart_edit_correction`: Smart Edit correction result.
335
- - **Attributes**:
336
- - `correction` ("success" | "failure")
337
-
338
- - `gen_ai.client.inference.operation.details`: This event provides detailed
339
- information about the GenAI operation, aligned with [OpenTelemetry GenAI
340
- semantic conventions for events].
341
- - **Attributes**:
342
- - `gen_ai.request.model` (string)
343
- - `gen_ai.provider.name` (string)
344
- - `gen_ai.operation.name` (string)
345
- - `gen_ai.input.messages` (json string)
346
- - `gen_ai.output.messages` (json string)
347
- - `gen_ai.response.finish_reasons` (array of strings)
348
- - `gen_ai.usage.input_tokens` (int)
349
- - `gen_ai.usage.output_tokens` (int)
350
- - `gen_ai.request.temperature` (float)
351
- - `gen_ai.request.top_p` (float)
352
- - `gen_ai.request.top_k` (int)
353
- - `gen_ai.request.max_tokens` (int)
354
- - `gen_ai.system_instructions` (json string)
355
- - `server.address` (string)
356
- - `server.port` (int)
357
-
358
- #### Files
359
-
360
- Tracks file operations performed by tools.
361
-
362
- - `gemini_cli.file_operation`: Emitted for each file operation.
363
- - **Attributes**:
364
- - `tool_name` (string)
365
- - `operation` ("create" | "read" | "update")
366
- - `lines` (int, optional)
367
- - `mimetype` (string, optional)
368
- - `extension` (string, optional)
369
- - `programming_language` (string, optional)
370
-
371
- #### API
372
-
373
- Captures Gemini API requests, responses, and errors.
374
-
375
- - `gemini_cli.api_request`: Request sent to Gemini API.
376
- - **Attributes**:
377
- - `model` (string)
378
- - `prompt_id` (string)
379
- - `request_text` (string, optional)
380
-
381
- - `gemini_cli.api_response`: Response received from Gemini API.
382
- - **Attributes**:
383
- - `model` (string)
384
- - `status_code` (int|string)
385
- - `duration_ms` (int)
386
- - `input_token_count` (int)
387
- - `output_token_count` (int)
388
- - `cached_content_token_count` (int)
389
- - `thoughts_token_count` (int)
390
- - `tool_token_count` (int)
391
- - `total_token_count` (int)
392
- - `response_text` (string, optional)
393
- - `prompt_id` (string)
394
- - `auth_type` (string)
395
- - `finish_reasons` (array of strings)
396
-
397
- - `gemini_cli.api_error`: API request failed.
398
- - **Attributes**:
399
- - `model` (string)
400
- - `error` (string)
401
- - `error_type` (string)
402
- - `status_code` (int|string)
403
- - `duration_ms` (int)
404
- - `prompt_id` (string)
405
- - `auth_type` (string)
406
-
407
- - `gemini_cli.malformed_json_response`: `generateJson` response could not be
408
- parsed.
409
- - **Attributes**:
410
- - `model` (string)
411
-
412
- #### Model routing
413
-
414
- - `gemini_cli.slash_command`: A slash command was executed.
415
- - **Attributes**:
416
- - `command` (string)
417
- - `subcommand` (string, optional)
418
- - `status` ("success" | "error")
419
-
420
- - `gemini_cli.slash_command.model`: Model was selected via slash command.
421
- - **Attributes**:
422
- - `model_name` (string)
423
-
424
- - `gemini_cli.model_routing`: Model router made a decision.
425
- - **Attributes**:
426
- - `decision_model` (string)
427
- - `decision_source` (string)
428
- - `routing_latency_ms` (int)
429
- - `reasoning` (string, optional)
430
- - `failed` (boolean)
431
- - `error_message` (string, optional)
432
-
433
- #### Chat and streaming
434
-
435
- - `gemini_cli.chat_compression`: Chat context was compressed.
436
- - **Attributes**:
437
- - `tokens_before` (int)
438
- - `tokens_after` (int)
439
-
440
- - `gemini_cli.chat.invalid_chunk`: Invalid chunk received from a stream.
441
- - **Attributes**:
442
- - `error.message` (string, optional)
443
-
444
- - `gemini_cli.chat.content_retry`: Retry triggered due to a content error.
445
- - **Attributes**:
446
- - `attempt_number` (int)
447
- - `error_type` (string)
448
- - `retry_delay_ms` (int)
449
- - `model` (string)
450
-
451
- - `gemini_cli.chat.content_retry_failure`: All content retries failed.
452
- - **Attributes**:
453
- - `total_attempts` (int)
454
- - `final_error_type` (string)
455
- - `total_duration_ms` (int, optional)
456
- - `model` (string)
457
-
458
- - `gemini_cli.conversation_finished`: Conversation session ended.
459
- - **Attributes**:
460
- - `approvalMode` (string)
461
- - `turnCount` (int)
462
-
463
- - `gemini_cli.next_speaker_check`: Next speaker determination.
464
- - **Attributes**:
465
- - `prompt_id` (string)
466
- - `finish_reason` (string)
467
- - `result` (string)
468
-
469
- #### Resilience
470
-
471
- Records fallback mechanisms for models and network operations.
472
-
473
- - `gemini_cli.flash_fallback`: Switched to a flash model as fallback.
474
- - **Attributes**:
475
- - `auth_type` (string)
476
-
477
- - `gemini_cli.ripgrep_fallback`: Switched to grep as fallback for file search.
478
- - **Attributes**:
479
- - `error` (string, optional)
480
-
481
- - `gemini_cli.web_fetch_fallback_attempt`: Attempted web-fetch fallback.
482
- - **Attributes**:
483
- - `reason` ("private_ip" | "primary_failed")
484
-
485
- #### Extensions
486
-
487
- Tracks extension lifecycle and settings changes.
488
-
489
- - `gemini_cli.extension_install`: An extension was installed.
490
- - **Attributes**:
491
- - `extension_name` (string)
492
- - `extension_version` (string)
493
- - `extension_source` (string)
494
- - `status` (string)
495
-
496
- - `gemini_cli.extension_uninstall`: An extension was uninstalled.
497
- - **Attributes**:
498
- - `extension_name` (string)
499
- - `status` (string)
500
-
501
- - `gemini_cli.extension_enable`: An extension was enabled.
502
- - **Attributes**:
503
- - `extension_name` (string)
504
- - `setting_scope` (string)
505
-
506
- - `gemini_cli.extension_disable`: An extension was disabled.
507
- - **Attributes**:
508
- - `extension_name` (string)
509
- - `setting_scope` (string)
510
-
511
- - `gemini_cli.extension_update`: An extension was updated.
512
- - **Attributes**:
513
- - `extension_name` (string)
514
- - `extension_version` (string)
515
- - `extension_previous_version` (string)
516
- - `extension_source` (string)
517
- - `status` (string)
518
-
519
- #### Agent runs
520
-
521
- - `gemini_cli.agent.start`: Agent run started.
522
- - **Attributes**:
523
- - `agent_id` (string)
524
- - `agent_name` (string)
525
-
526
- - `gemini_cli.agent.finish`: Agent run finished.
527
- - **Attributes**:
528
- - `agent_id` (string)
529
- - `agent_name` (string)
530
- - `duration_ms` (int)
531
- - `turn_count` (int)
532
- - `terminate_reason` (string)
533
-
534
- #### IDE
535
-
536
- Captures IDE connectivity and conversation lifecycle events.
537
-
538
- - `gemini_cli.ide_connection`: IDE companion connection.
539
- - **Attributes**:
540
- - `connection_type` (string)
541
-
542
- #### UI
543
-
544
- Tracks terminal rendering issues and related signals.
545
-
546
- - `kitty_sequence_overflow`: Terminal kitty control sequence overflow.
547
- - **Attributes**:
548
- - `sequence_length` (int)
549
- - `truncated_sequence` (string)
550
-
551
- ### Metrics
552
-
553
- Metrics are numerical measurements of behavior over time.
554
-
555
- #### Custom
556
-
557
- ##### Sessions
558
-
559
- Counts CLI sessions at startup.
560
-
561
- - `gemini_cli.session.count` (Counter, Int): Incremented once per CLI startup.
562
-
563
- ##### Tools
564
-
565
- Measures tool usage and latency.
566
-
567
- - `gemini_cli.tool.call.count` (Counter, Int): Counts tool calls.
568
- - **Attributes**:
569
- - `function_name`
570
- - `success` (boolean)
571
- - `decision` (string: "accept", "reject", "modify", or "auto_accept", if
572
- applicable)
573
- - `tool_type` (string: "mcp" or "native", if applicable)
574
-
575
- - `gemini_cli.tool.call.latency` (Histogram, ms): Measures tool call latency.
576
- - **Attributes**:
577
- - `function_name`
578
-
579
- ##### API
580
-
581
- Tracks API request volume and latency.
582
-
583
- - `gemini_cli.api.request.count` (Counter, Int): Counts all API requests.
584
- - **Attributes**:
585
- - `model`
586
- - `status_code`
587
- - `error_type` (if applicable)
588
-
589
- - `gemini_cli.api.request.latency` (Histogram, ms): Measures API request
590
- latency.
591
- - **Attributes**:
592
- - `model`
593
- - Note: Overlaps with `gen_ai.client.operation.duration` (GenAI conventions).
594
-
595
- ##### Token usage
596
-
597
- Tracks tokens used by model and type.
598
-
599
- - `gemini_cli.token.usage` (Counter, Int): Counts tokens used.
600
- - **Attributes**:
601
- - `model`
602
- - `type` ("input", "output", "thought", "cache", or "tool")
603
- - Note: Overlaps with `gen_ai.client.token.usage` for `input`/`output`.
604
-
605
- ##### Files
606
-
607
- Counts file operations with basic context.
608
-
609
- - `gemini_cli.file.operation.count` (Counter, Int): Counts file operations.
610
- - **Attributes**:
611
- - `operation` ("create", "read", "update")
612
- - `lines` (Int, optional)
613
- - `mimetype` (string, optional)
614
- - `extension` (string, optional)
615
- - `programming_language` (string, optional)
616
-
617
- - `gemini_cli.lines.changed` (Counter, Int): Number of lines changed (from file
618
- diffs).
619
- - **Attributes**:
620
- - `function_name`
621
- - `type` ("added" or "removed")
622
-
623
- ##### Chat and streaming
624
-
625
- Resilience counters for compression, invalid chunks, and retries.
626
-
627
- - `gemini_cli.chat_compression` (Counter, Int): Counts chat compression
628
- operations.
629
- - **Attributes**:
630
- - `tokens_before` (Int)
631
- - `tokens_after` (Int)
632
-
633
- - `gemini_cli.chat.invalid_chunk.count` (Counter, Int): Counts invalid chunks
634
- from streams.
635
-
636
- - `gemini_cli.chat.content_retry.count` (Counter, Int): Counts retries due to
637
- content errors.
638
-
639
- - `gemini_cli.chat.content_retry_failure.count` (Counter, Int): Counts requests
640
- where all content retries failed.
641
-
642
- ##### Model routing
643
-
644
- Routing latency/failures and slash-command selections.
645
-
646
- - `gemini_cli.slash_command.model.call_count` (Counter, Int): Counts model
647
- selections via slash command.
648
- - **Attributes**:
649
- - `slash_command.model.model_name` (string)
650
-
651
- - `gemini_cli.model_routing.latency` (Histogram, ms): Model routing decision
652
- latency.
653
- - **Attributes**:
654
- - `routing.decision_model` (string)
655
- - `routing.decision_source` (string)
656
-
657
- - `gemini_cli.model_routing.failure.count` (Counter, Int): Counts model routing
658
- failures.
659
- - **Attributes**:
660
- - `routing.decision_source` (string)
661
- - `routing.error_message` (string)
662
-
663
- ##### Agent runs
664
-
665
- Agent lifecycle metrics: runs, durations, and turns.
666
-
667
- - `gemini_cli.agent.run.count` (Counter, Int): Counts agent runs.
668
- - **Attributes**:
669
- - `agent_name` (string)
670
- - `terminate_reason` (string)
671
-
672
- - `gemini_cli.agent.duration` (Histogram, ms): Agent run durations.
673
- - **Attributes**:
674
- - `agent_name` (string)
675
-
676
- - `gemini_cli.agent.turns` (Histogram, turns): Turns taken per agent run.
677
- - **Attributes**:
678
- - `agent_name` (string)
679
-
680
- ##### UI
681
-
682
- UI stability signals such as flicker count.
683
-
684
- - `gemini_cli.ui.flicker.count` (Counter, Int): Counts UI frames that flicker
685
- (render taller than terminal).
686
-
687
- ##### Performance
688
-
689
- Optional performance monitoring for startup, CPU/memory, and phase timing.
690
-
691
- - `gemini_cli.startup.duration` (Histogram, ms): CLI startup time by phase.
692
- - **Attributes**:
693
- - `phase` (string)
694
- - `details` (map, optional)
695
-
696
- - `gemini_cli.memory.usage` (Histogram, bytes): Memory usage.
697
- - **Attributes**:
698
- - `memory_type` ("heap_used", "heap_total", "external", "rss")
699
- - `component` (string, optional)
700
-
701
- - `gemini_cli.cpu.usage` (Histogram, percent): CPU usage percentage.
702
- - **Attributes**:
703
- - `component` (string, optional)
704
-
705
- - `gemini_cli.tool.queue.depth` (Histogram, count): Number of tools in the
706
- execution queue.
707
-
708
- - `gemini_cli.tool.execution.breakdown` (Histogram, ms): Tool time by phase.
709
- - **Attributes**:
710
- - `function_name` (string)
711
- - `phase` ("validation", "preparation", "execution", "result_processing")
712
-
713
- - `gemini_cli.api.request.breakdown` (Histogram, ms): API request time by phase.
714
- - **Attributes**:
715
- - `model` (string)
716
- - `phase` ("request_preparation", "network_latency", "response_processing",
717
- "token_processing")
718
-
719
- - `gemini_cli.token.efficiency` (Histogram, ratio): Token efficiency metrics.
720
- - **Attributes**:
721
- - `model` (string)
722
- - `metric` (string)
723
- - `context` (string, optional)
724
-
725
- - `gemini_cli.performance.score` (Histogram, score): Composite performance
726
- score.
727
- - **Attributes**:
728
- - `category` (string)
729
- - `baseline` (number, optional)
730
-
731
- - `gemini_cli.performance.regression` (Counter, Int): Regression detection
732
- events.
733
- - **Attributes**:
734
- - `metric` (string)
735
- - `severity` ("low", "medium", "high")
736
- - `current_value` (number)
737
- - `baseline_value` (number)
738
-
739
- - `gemini_cli.performance.regression.percentage_change` (Histogram, percent):
740
- Percent change from baseline when regression detected.
741
- - **Attributes**:
742
- - `metric` (string)
743
- - `severity` ("low", "medium", "high")
744
- - `current_value` (number)
745
- - `baseline_value` (number)
746
-
747
- - `gemini_cli.performance.baseline.comparison` (Histogram, percent): Comparison
748
- to baseline.
749
- - **Attributes**:
750
- - `metric` (string)
751
- - `category` (string)
752
- - `current_value` (number)
753
- - `baseline_value` (number)
754
-
755
- #### GenAI semantic convention
756
-
757
- The following metrics comply with [OpenTelemetry GenAI semantic conventions] for
758
- standardized observability across GenAI applications:
759
-
760
- - `gen_ai.client.token.usage` (Histogram, token): Number of input and output
761
- tokens used per operation.
762
- - **Attributes**:
763
- - `gen_ai.operation.name` (string): The operation type (e.g.,
764
- "generate_content", "chat")
765
- - `gen_ai.provider.name` (string): The GenAI provider ("gcp.gen_ai" or
766
- "gcp.vertex_ai")
767
- - `gen_ai.token.type` (string): The token type ("input" or "output")
768
- - `gen_ai.request.model` (string, optional): The model name used for the
769
- request
770
- - `gen_ai.response.model` (string, optional): The model name that generated
771
- the response
772
- - `server.address` (string, optional): GenAI server address
773
- - `server.port` (int, optional): GenAI server port
774
-
775
- - `gen_ai.client.operation.duration` (Histogram, s): GenAI operation duration in
776
- seconds.
777
- - **Attributes**:
778
- - `gen_ai.operation.name` (string): The operation type (e.g.,
779
- "generate_content", "chat")
780
- - `gen_ai.provider.name` (string): The GenAI provider ("gcp.gen_ai" or
781
- "gcp.vertex_ai")
782
- - `gen_ai.request.model` (string, optional): The model name used for the
783
- request
784
- - `gen_ai.response.model` (string, optional): The model name that generated
785
- the response
786
- - `server.address` (string, optional): GenAI server address
787
- - `server.port` (int, optional): GenAI server port
788
- - `error.type` (string, optional): Error type if the operation failed
789
-
790
- [OpenTelemetry GenAI semantic conventions]:
791
- https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-metrics.md
792
- [OpenTelemetry GenAI semantic conventions for events]:
793
- https://github.com/open-telemetry/semantic-conventions/blob/8b4f210f43136e57c1f6f47292eb6d38e3bf30bb/docs/gen-ai/gen-ai-events.md
3
+ Telemetry has been removed from TerminaI. For details on this change, please see
4
+ [TerminaI Telemetry](../../docs-terminai/terminai_telemetry.md).