@google/gemini-cli-core 0.21.0-nightly.20251219.70696e364 → 0.21.0-nightly.20251220.41a1a3eed

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 (172) hide show
  1. package/dist/docs/CONTRIBUTING.md +546 -0
  2. package/dist/docs/architecture.md +80 -0
  3. package/dist/docs/assets/connected_devtools.png +0 -0
  4. package/dist/docs/assets/gemini-screenshot.png +0 -0
  5. package/dist/docs/assets/release_patch.png +0 -0
  6. package/dist/docs/assets/theme-ansi-light.png +0 -0
  7. package/dist/docs/assets/theme-ansi.png +0 -0
  8. package/dist/docs/assets/theme-atom-one.png +0 -0
  9. package/dist/docs/assets/theme-ayu-light.png +0 -0
  10. package/dist/docs/assets/theme-ayu.png +0 -0
  11. package/dist/docs/assets/theme-custom.png +0 -0
  12. package/dist/docs/assets/theme-default-light.png +0 -0
  13. package/dist/docs/assets/theme-default.png +0 -0
  14. package/dist/docs/assets/theme-dracula.png +0 -0
  15. package/dist/docs/assets/theme-github-light.png +0 -0
  16. package/dist/docs/assets/theme-github.png +0 -0
  17. package/dist/docs/assets/theme-google-light.png +0 -0
  18. package/dist/docs/assets/theme-xcode-light.png +0 -0
  19. package/dist/docs/changelogs/index.md +592 -0
  20. package/dist/docs/changelogs/latest.md +225 -0
  21. package/dist/docs/changelogs/preview.md +129 -0
  22. package/dist/docs/changelogs/releases.md +896 -0
  23. package/dist/docs/cli/authentication.md +3 -0
  24. package/dist/docs/cli/checkpointing.md +94 -0
  25. package/dist/docs/cli/commands.md +354 -0
  26. package/dist/docs/cli/configuration.md +780 -0
  27. package/dist/docs/cli/custom-commands.md +315 -0
  28. package/dist/docs/cli/enterprise.md +565 -0
  29. package/dist/docs/cli/gemini-ignore.md +71 -0
  30. package/dist/docs/cli/gemini-md.md +108 -0
  31. package/dist/docs/cli/generation-settings.md +210 -0
  32. package/dist/docs/cli/headless.md +388 -0
  33. package/dist/docs/cli/index.md +63 -0
  34. package/dist/docs/cli/keyboard-shortcuts.md +143 -0
  35. package/dist/docs/cli/model-routing.md +37 -0
  36. package/dist/docs/cli/model.md +62 -0
  37. package/dist/docs/cli/sandbox.md +171 -0
  38. package/dist/docs/cli/session-management.md +158 -0
  39. package/dist/docs/cli/settings.md +112 -0
  40. package/dist/docs/cli/system-prompt.md +93 -0
  41. package/dist/docs/cli/telemetry.md +791 -0
  42. package/dist/docs/cli/themes.md +237 -0
  43. package/dist/docs/cli/token-caching.md +20 -0
  44. package/dist/docs/cli/trusted-folders.md +95 -0
  45. package/dist/docs/cli/tutorials.md +83 -0
  46. package/dist/docs/cli/uninstall.md +47 -0
  47. package/dist/docs/core/index.md +101 -0
  48. package/dist/docs/core/memport.md +244 -0
  49. package/dist/docs/core/policy-engine.md +267 -0
  50. package/dist/docs/core/tools-api.md +131 -0
  51. package/dist/docs/examples/proxy-script.md +83 -0
  52. package/dist/docs/extensions/extension-releasing.md +183 -0
  53. package/dist/docs/extensions/getting-started-extensions.md +245 -0
  54. package/dist/docs/extensions/index.md +293 -0
  55. package/dist/docs/faq.md +154 -0
  56. package/dist/docs/get-started/authentication.md +321 -0
  57. package/dist/docs/get-started/configuration-v1.md +888 -0
  58. package/dist/docs/get-started/configuration.md +1444 -0
  59. package/dist/docs/get-started/deployment.md +143 -0
  60. package/dist/docs/get-started/examples.md +219 -0
  61. package/dist/docs/get-started/gemini-3.md +116 -0
  62. package/dist/docs/get-started/index.md +71 -0
  63. package/dist/docs/get-started/installation.md +141 -0
  64. package/dist/docs/hooks/best-practices.md +806 -0
  65. package/dist/docs/hooks/index.md +665 -0
  66. package/dist/docs/hooks/reference.md +168 -0
  67. package/dist/docs/hooks/writing-hooks.md +1026 -0
  68. package/dist/docs/ide-integration/ide-companion-spec.md +267 -0
  69. package/dist/docs/ide-integration/index.md +202 -0
  70. package/dist/docs/index.md +147 -0
  71. package/dist/docs/integration-tests.md +211 -0
  72. package/dist/docs/issue-and-pr-automation.md +134 -0
  73. package/dist/docs/local-development.md +128 -0
  74. package/dist/docs/mermaid/context.mmd +103 -0
  75. package/dist/docs/mermaid/render-path.mmd +64 -0
  76. package/dist/docs/npm.md +62 -0
  77. package/dist/docs/quota-and-pricing.md +158 -0
  78. package/dist/docs/release-confidence.md +164 -0
  79. package/dist/docs/releases.md +540 -0
  80. package/dist/docs/sidebar.json +297 -0
  81. package/dist/docs/tools/file-system.md +217 -0
  82. package/dist/docs/tools/index.md +95 -0
  83. package/dist/docs/tools/mcp-server.md +1044 -0
  84. package/dist/docs/tools/memory.md +54 -0
  85. package/dist/docs/tools/shell.md +260 -0
  86. package/dist/docs/tools/todos.md +57 -0
  87. package/dist/docs/tools/web-fetch.md +59 -0
  88. package/dist/docs/tools/web-search.md +42 -0
  89. package/dist/docs/tos-privacy.md +96 -0
  90. package/dist/docs/troubleshooting.md +158 -0
  91. package/dist/google-gemini-cli-core-0.21.0-nightly.20251219.70696e364.tgz +0 -0
  92. package/dist/src/agents/delegate-to-agent-tool.test.js +1 -0
  93. package/dist/src/agents/delegate-to-agent-tool.test.js.map +1 -1
  94. package/dist/src/agents/introspection-agent.d.ts +23 -0
  95. package/dist/src/agents/introspection-agent.js +72 -0
  96. package/dist/src/agents/introspection-agent.js.map +1 -0
  97. package/dist/src/agents/introspection-agent.test.d.ts +6 -0
  98. package/dist/src/agents/introspection-agent.test.js +47 -0
  99. package/dist/src/agents/introspection-agent.test.js.map +1 -0
  100. package/dist/src/agents/local-executor.js +14 -12
  101. package/dist/src/agents/local-executor.js.map +1 -1
  102. package/dist/src/agents/local-executor.test.js +3 -0
  103. package/dist/src/agents/local-executor.test.js.map +1 -1
  104. package/dist/src/agents/registry.js +6 -0
  105. package/dist/src/agents/registry.js.map +1 -1
  106. package/dist/src/agents/registry.test.js +16 -0
  107. package/dist/src/agents/registry.test.js.map +1 -1
  108. package/dist/src/config/config.d.ts +6 -0
  109. package/dist/src/config/config.js +22 -0
  110. package/dist/src/config/config.js.map +1 -1
  111. package/dist/src/config/config.test.js +59 -1
  112. package/dist/src/config/config.test.js.map +1 -1
  113. package/dist/src/core/client.js +8 -4
  114. package/dist/src/core/client.js.map +1 -1
  115. package/dist/src/core/client.test.js +20 -0
  116. package/dist/src/core/client.test.js.map +1 -1
  117. package/dist/src/core/clientHookTriggers.js +2 -2
  118. package/dist/src/core/clientHookTriggers.js.map +1 -1
  119. package/dist/src/core/coreToolHookTriggers.js +3 -3
  120. package/dist/src/core/coreToolHookTriggers.js.map +1 -1
  121. package/dist/src/core/geminiChatHookTriggers.js +3 -3
  122. package/dist/src/core/geminiChatHookTriggers.js.map +1 -1
  123. package/dist/src/core/sessionHookTriggers.js +3 -3
  124. package/dist/src/core/sessionHookTriggers.js.map +1 -1
  125. package/dist/src/generated/git-commit.d.ts +2 -2
  126. package/dist/src/generated/git-commit.js +2 -2
  127. package/dist/src/hooks/hookEventHandler.js +10 -4
  128. package/dist/src/hooks/hookEventHandler.js.map +1 -1
  129. package/dist/src/hooks/hookEventHandler.test.js +40 -0
  130. package/dist/src/hooks/hookEventHandler.test.js.map +1 -1
  131. package/dist/src/hooks/hookRunner.js +12 -8
  132. package/dist/src/hooks/hookRunner.js.map +1 -1
  133. package/dist/src/hooks/hookRunner.test.js +58 -33
  134. package/dist/src/hooks/hookRunner.test.js.map +1 -1
  135. package/dist/src/mcp/oauth-provider.js +6 -2
  136. package/dist/src/mcp/oauth-provider.js.map +1 -1
  137. package/dist/src/mcp/oauth-provider.test.js +4 -1
  138. package/dist/src/mcp/oauth-provider.test.js.map +1 -1
  139. package/dist/src/mcp/oauth-utils.d.ts +8 -1
  140. package/dist/src/mcp/oauth-utils.js +30 -1
  141. package/dist/src/mcp/oauth-utils.js.map +1 -1
  142. package/dist/src/mcp/oauth-utils.test.js +42 -0
  143. package/dist/src/mcp/oauth-utils.test.js.map +1 -1
  144. package/dist/src/services/contextManager.d.ts +5 -11
  145. package/dist/src/services/contextManager.js +20 -17
  146. package/dist/src/services/contextManager.js.map +1 -1
  147. package/dist/src/services/contextManager.test.js +40 -41
  148. package/dist/src/services/contextManager.test.js.map +1 -1
  149. package/dist/src/tools/get-internal-docs.d.ts +27 -0
  150. package/dist/src/tools/get-internal-docs.js +129 -0
  151. package/dist/src/tools/get-internal-docs.js.map +1 -0
  152. package/dist/src/tools/get-internal-docs.test.d.ts +6 -0
  153. package/dist/src/tools/get-internal-docs.test.js +56 -0
  154. package/dist/src/tools/get-internal-docs.test.js.map +1 -0
  155. package/dist/src/tools/tool-names.d.ts +1 -0
  156. package/dist/src/tools/tool-names.js +1 -0
  157. package/dist/src/tools/tool-names.js.map +1 -1
  158. package/dist/src/utils/environmentContext.js +3 -0
  159. package/dist/src/utils/environmentContext.js.map +1 -1
  160. package/dist/src/utils/environmentContext.test.js +2 -0
  161. package/dist/src/utils/environmentContext.test.js.map +1 -1
  162. package/dist/src/utils/events.d.ts +3 -2
  163. package/dist/src/utils/events.js.map +1 -1
  164. package/dist/src/utils/memoryDiscovery.js +1 -1
  165. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  166. package/dist/src/utils/memoryDiscovery.test.js +3 -1
  167. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  168. package/dist/src/utils/shell-utils.js +25 -4
  169. package/dist/src/utils/shell-utils.js.map +1 -1
  170. package/dist/tsconfig.tsbuildinfo +1 -1
  171. package/package.json +1 -1
  172. package/dist/google-gemini-cli-core-0.21.0-nightly.20251218.739c02bd6.tgz +0 -0
@@ -0,0 +1,791 @@
1
+ # Observability with OpenTelemetry
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 `.gemini/settings.json` file.
75
+ Environment variables can be used to override the settings in the file.
76
+
77
+ | Setting | Environment Variable | Description | Values | Default |
78
+ | -------------- | -------------------------------- | --------------------------------------------------- | ----------------- | ----------------------- |
79
+ | `enabled` | `GEMINI_TELEMETRY_ENABLED` | Enable or disable telemetry | `true`/`false` | `false` |
80
+ | `target` | `GEMINI_TELEMETRY_TARGET` | Where to send telemetry data | `"gcp"`/`"local"` | `"local"` |
81
+ | `otlpEndpoint` | `GEMINI_TELEMETRY_OTLP_ENDPOINT` | OTLP collector endpoint | URL string | `http://localhost:4317` |
82
+ | `otlpProtocol` | `GEMINI_TELEMETRY_OTLP_PROTOCOL` | OTLP transport protocol | `"grpc"`/`"http"` | `"grpc"` |
83
+ | `outfile` | `GEMINI_TELEMETRY_OUTFILE` | Save telemetry to file (overrides `otlpEndpoint`) | file path | - |
84
+ | `logPrompts` | `GEMINI_TELEMETRY_LOG_PROMPTS` | Include prompts in telemetry logs | `true`/`false` | `true` |
85
+ | `useCollector` | `GEMINI_TELEMETRY_USE_COLLECTOR` | Use external OTLP collector (advanced) | `true`/`false` | `false` |
86
+ | `useCliAuth` | `GEMINI_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 `.gemini/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 `.gemini/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 `~/.gemini/tmp/<projectHash>/otel/collector-gcp.log`
206
+ - Stop collector on exit (e.g. `Ctrl+C`)
207
+ 3. Run Gemini CLI and send prompts.
208
+ 4. View logs and metrics:
209
+ - Open the Google Cloud Console in your browser after sending prompts:
210
+ - Logs: https://console.cloud.google.com/logs/
211
+ - Metrics: https://console.cloud.google.com/monitoring/metrics-explorer
212
+ - Traces: https://console.cloud.google.com/traces/list
213
+ - Open `~/.gemini/tmp/<projectHash>/otel/collector-gcp.log` to view local
214
+ collector logs.
215
+
216
+ ## Local telemetry
217
+
218
+ For local development and debugging, you can capture telemetry data locally:
219
+
220
+ ### File-based output (recommended)
221
+
222
+ 1. Enable telemetry in your `.gemini/settings.json`:
223
+ ```json
224
+ {
225
+ "telemetry": {
226
+ "enabled": true,
227
+ "target": "local",
228
+ "otlpEndpoint": "",
229
+ "outfile": ".gemini/telemetry.log"
230
+ }
231
+ }
232
+ ```
233
+ 2. Run Gemini CLI and send prompts.
234
+ 3. View logs and metrics in the specified file (e.g., `.gemini/telemetry.log`).
235
+
236
+ ### Collector-based export (advanced)
237
+
238
+ 1. Run the automation script:
239
+ ```bash
240
+ npm run telemetry -- --target=local
241
+ ```
242
+ This will:
243
+ - Download and start Jaeger and OTEL collector
244
+ - Configure your workspace for local telemetry
245
+ - Provide a Jaeger UI at http://localhost:16686
246
+ - Save logs/metrics to `~/.gemini/tmp/<projectHash>/otel/collector.log`
247
+ - Stop collector on exit (e.g. `Ctrl+C`)
248
+ 2. Run Gemini CLI and send prompts.
249
+ 3. View traces at http://localhost:16686 and logs/metrics in the collector log
250
+ file.
251
+
252
+ ## Logs and metrics
253
+
254
+ The following section describes the structure of logs and metrics generated for
255
+ Gemini CLI.
256
+
257
+ The `session.id`, `installation.id`, and `user.email` (available only when
258
+ authenticated with a Google account) are included as common attributes on all
259
+ logs and metrics.
260
+
261
+ ### Logs
262
+
263
+ Logs are timestamped records of specific events. The following events are logged
264
+ for Gemini CLI, grouped by category.
265
+
266
+ #### Sessions
267
+
268
+ Captures startup configuration and user prompt submissions.
269
+
270
+ - `gemini_cli.config`: Emitted once at startup with the CLI configuration.
271
+ - **Attributes**:
272
+ - `model` (string)
273
+ - `embedding_model` (string)
274
+ - `sandbox_enabled` (boolean)
275
+ - `core_tools_enabled` (string)
276
+ - `approval_mode` (string)
277
+ - `api_key_enabled` (boolean)
278
+ - `vertex_ai_enabled` (boolean)
279
+ - `log_user_prompts_enabled` (boolean)
280
+ - `file_filtering_respect_git_ignore` (boolean)
281
+ - `debug_mode` (boolean)
282
+ - `mcp_servers` (string)
283
+ - `mcp_servers_count` (int)
284
+ - `extensions` (string)
285
+ - `extension_ids` (string)
286
+ - `extension_count` (int)
287
+ - `mcp_tools` (string, if applicable)
288
+ - `mcp_tools_count` (int, if applicable)
289
+ - `output_format` ("text", "json", or "stream-json")
290
+
291
+ - `gemini_cli.user_prompt`: Emitted when a user submits a prompt.
292
+ - **Attributes**:
293
+ - `prompt_length` (int)
294
+ - `prompt_id` (string)
295
+ - `prompt` (string; excluded if `telemetry.logPrompts` is `false`)
296
+ - `auth_type` (string)
297
+
298
+ #### Tools
299
+
300
+ Captures tool executions, output truncation, and Smart Edit behavior.
301
+
302
+ - `gemini_cli.tool_call`: Emitted for each tool (function) call.
303
+ - **Attributes**:
304
+ - `function_name`
305
+ - `function_args`
306
+ - `duration_ms`
307
+ - `success` (boolean)
308
+ - `decision` ("accept", "reject", "auto_accept", or "modify", if applicable)
309
+ - `error` (if applicable)
310
+ - `error_type` (if applicable)
311
+ - `prompt_id` (string)
312
+ - `tool_type` ("native" or "mcp")
313
+ - `mcp_server_name` (string, if applicable)
314
+ - `extension_name` (string, if applicable)
315
+ - `extension_id` (string, if applicable)
316
+ - `content_length` (int, if applicable)
317
+ - `metadata` (if applicable)
318
+
319
+ - `gemini_cli.tool_output_truncated`: Output of a tool call was truncated.
320
+ - **Attributes**:
321
+ - `tool_name` (string)
322
+ - `original_content_length` (int)
323
+ - `truncated_content_length` (int)
324
+ - `threshold` (int)
325
+ - `lines` (int)
326
+ - `prompt_id` (string)
327
+
328
+ - `gemini_cli.smart_edit_strategy`: Smart Edit strategy chosen.
329
+ - **Attributes**:
330
+ - `strategy` (string)
331
+
332
+ - `gemini_cli.smart_edit_correction`: Smart Edit correction result.
333
+ - **Attributes**:
334
+ - `correction` ("success" | "failure")
335
+
336
+ - `gen_ai.client.inference.operation.details`: This event provides detailed
337
+ information about the GenAI operation, aligned with [OpenTelemetry GenAI
338
+ semantic conventions for events].
339
+ - **Attributes**:
340
+ - `gen_ai.request.model` (string)
341
+ - `gen_ai.provider.name` (string)
342
+ - `gen_ai.operation.name` (string)
343
+ - `gen_ai.input.messages` (json string)
344
+ - `gen_ai.output.messages` (json string)
345
+ - `gen_ai.response.finish_reasons` (array of strings)
346
+ - `gen_ai.usage.input_tokens` (int)
347
+ - `gen_ai.usage.output_tokens` (int)
348
+ - `gen_ai.request.temperature` (float)
349
+ - `gen_ai.request.top_p` (float)
350
+ - `gen_ai.request.top_k` (int)
351
+ - `gen_ai.request.max_tokens` (int)
352
+ - `gen_ai.system_instructions` (json string)
353
+ - `server.address` (string)
354
+ - `server.port` (int)
355
+
356
+ #### Files
357
+
358
+ Tracks file operations performed by tools.
359
+
360
+ - `gemini_cli.file_operation`: Emitted for each file operation.
361
+ - **Attributes**:
362
+ - `tool_name` (string)
363
+ - `operation` ("create" | "read" | "update")
364
+ - `lines` (int, optional)
365
+ - `mimetype` (string, optional)
366
+ - `extension` (string, optional)
367
+ - `programming_language` (string, optional)
368
+
369
+ #### API
370
+
371
+ Captures Gemini API requests, responses, and errors.
372
+
373
+ - `gemini_cli.api_request`: Request sent to Gemini API.
374
+ - **Attributes**:
375
+ - `model` (string)
376
+ - `prompt_id` (string)
377
+ - `request_text` (string, optional)
378
+
379
+ - `gemini_cli.api_response`: Response received from Gemini API.
380
+ - **Attributes**:
381
+ - `model` (string)
382
+ - `status_code` (int|string)
383
+ - `duration_ms` (int)
384
+ - `input_token_count` (int)
385
+ - `output_token_count` (int)
386
+ - `cached_content_token_count` (int)
387
+ - `thoughts_token_count` (int)
388
+ - `tool_token_count` (int)
389
+ - `total_token_count` (int)
390
+ - `response_text` (string, optional)
391
+ - `prompt_id` (string)
392
+ - `auth_type` (string)
393
+ - `finish_reasons` (array of strings)
394
+
395
+ - `gemini_cli.api_error`: API request failed.
396
+ - **Attributes**:
397
+ - `model` (string)
398
+ - `error` (string)
399
+ - `error_type` (string)
400
+ - `status_code` (int|string)
401
+ - `duration_ms` (int)
402
+ - `prompt_id` (string)
403
+ - `auth_type` (string)
404
+
405
+ - `gemini_cli.malformed_json_response`: `generateJson` response could not be
406
+ parsed.
407
+ - **Attributes**:
408
+ - `model` (string)
409
+
410
+ #### Model routing
411
+
412
+ - `gemini_cli.slash_command`: A slash command was executed.
413
+ - **Attributes**:
414
+ - `command` (string)
415
+ - `subcommand` (string, optional)
416
+ - `status` ("success" | "error")
417
+
418
+ - `gemini_cli.slash_command.model`: Model was selected via slash command.
419
+ - **Attributes**:
420
+ - `model_name` (string)
421
+
422
+ - `gemini_cli.model_routing`: Model router made a decision.
423
+ - **Attributes**:
424
+ - `decision_model` (string)
425
+ - `decision_source` (string)
426
+ - `routing_latency_ms` (int)
427
+ - `reasoning` (string, optional)
428
+ - `failed` (boolean)
429
+ - `error_message` (string, optional)
430
+
431
+ #### Chat and streaming
432
+
433
+ - `gemini_cli.chat_compression`: Chat context was compressed.
434
+ - **Attributes**:
435
+ - `tokens_before` (int)
436
+ - `tokens_after` (int)
437
+
438
+ - `gemini_cli.chat.invalid_chunk`: Invalid chunk received from a stream.
439
+ - **Attributes**:
440
+ - `error.message` (string, optional)
441
+
442
+ - `gemini_cli.chat.content_retry`: Retry triggered due to a content error.
443
+ - **Attributes**:
444
+ - `attempt_number` (int)
445
+ - `error_type` (string)
446
+ - `retry_delay_ms` (int)
447
+ - `model` (string)
448
+
449
+ - `gemini_cli.chat.content_retry_failure`: All content retries failed.
450
+ - **Attributes**:
451
+ - `total_attempts` (int)
452
+ - `final_error_type` (string)
453
+ - `total_duration_ms` (int, optional)
454
+ - `model` (string)
455
+
456
+ - `gemini_cli.conversation_finished`: Conversation session ended.
457
+ - **Attributes**:
458
+ - `approvalMode` (string)
459
+ - `turnCount` (int)
460
+
461
+ - `gemini_cli.next_speaker_check`: Next speaker determination.
462
+ - **Attributes**:
463
+ - `prompt_id` (string)
464
+ - `finish_reason` (string)
465
+ - `result` (string)
466
+
467
+ #### Resilience
468
+
469
+ Records fallback mechanisms for models and network operations.
470
+
471
+ - `gemini_cli.flash_fallback`: Switched to a flash model as fallback.
472
+ - **Attributes**:
473
+ - `auth_type` (string)
474
+
475
+ - `gemini_cli.ripgrep_fallback`: Switched to grep as fallback for file search.
476
+ - **Attributes**:
477
+ - `error` (string, optional)
478
+
479
+ - `gemini_cli.web_fetch_fallback_attempt`: Attempted web-fetch fallback.
480
+ - **Attributes**:
481
+ - `reason` ("private_ip" | "primary_failed")
482
+
483
+ #### Extensions
484
+
485
+ Tracks extension lifecycle and settings changes.
486
+
487
+ - `gemini_cli.extension_install`: An extension was installed.
488
+ - **Attributes**:
489
+ - `extension_name` (string)
490
+ - `extension_version` (string)
491
+ - `extension_source` (string)
492
+ - `status` (string)
493
+
494
+ - `gemini_cli.extension_uninstall`: An extension was uninstalled.
495
+ - **Attributes**:
496
+ - `extension_name` (string)
497
+ - `status` (string)
498
+
499
+ - `gemini_cli.extension_enable`: An extension was enabled.
500
+ - **Attributes**:
501
+ - `extension_name` (string)
502
+ - `setting_scope` (string)
503
+
504
+ - `gemini_cli.extension_disable`: An extension was disabled.
505
+ - **Attributes**:
506
+ - `extension_name` (string)
507
+ - `setting_scope` (string)
508
+
509
+ - `gemini_cli.extension_update`: An extension was updated.
510
+ - **Attributes**:
511
+ - `extension_name` (string)
512
+ - `extension_version` (string)
513
+ - `extension_previous_version` (string)
514
+ - `extension_source` (string)
515
+ - `status` (string)
516
+
517
+ #### Agent runs
518
+
519
+ - `gemini_cli.agent.start`: Agent run started.
520
+ - **Attributes**:
521
+ - `agent_id` (string)
522
+ - `agent_name` (string)
523
+
524
+ - `gemini_cli.agent.finish`: Agent run finished.
525
+ - **Attributes**:
526
+ - `agent_id` (string)
527
+ - `agent_name` (string)
528
+ - `duration_ms` (int)
529
+ - `turn_count` (int)
530
+ - `terminate_reason` (string)
531
+
532
+ #### IDE
533
+
534
+ Captures IDE connectivity and conversation lifecycle events.
535
+
536
+ - `gemini_cli.ide_connection`: IDE companion connection.
537
+ - **Attributes**:
538
+ - `connection_type` (string)
539
+
540
+ #### UI
541
+
542
+ Tracks terminal rendering issues and related signals.
543
+
544
+ - `kitty_sequence_overflow`: Terminal kitty control sequence overflow.
545
+ - **Attributes**:
546
+ - `sequence_length` (int)
547
+ - `truncated_sequence` (string)
548
+
549
+ ### Metrics
550
+
551
+ Metrics are numerical measurements of behavior over time.
552
+
553
+ #### Custom
554
+
555
+ ##### Sessions
556
+
557
+ Counts CLI sessions at startup.
558
+
559
+ - `gemini_cli.session.count` (Counter, Int): Incremented once per CLI startup.
560
+
561
+ ##### Tools
562
+
563
+ Measures tool usage and latency.
564
+
565
+ - `gemini_cli.tool.call.count` (Counter, Int): Counts tool calls.
566
+ - **Attributes**:
567
+ - `function_name`
568
+ - `success` (boolean)
569
+ - `decision` (string: "accept", "reject", "modify", or "auto_accept", if
570
+ applicable)
571
+ - `tool_type` (string: "mcp" or "native", if applicable)
572
+
573
+ - `gemini_cli.tool.call.latency` (Histogram, ms): Measures tool call latency.
574
+ - **Attributes**:
575
+ - `function_name`
576
+
577
+ ##### API
578
+
579
+ Tracks API request volume and latency.
580
+
581
+ - `gemini_cli.api.request.count` (Counter, Int): Counts all API requests.
582
+ - **Attributes**:
583
+ - `model`
584
+ - `status_code`
585
+ - `error_type` (if applicable)
586
+
587
+ - `gemini_cli.api.request.latency` (Histogram, ms): Measures API request
588
+ latency.
589
+ - **Attributes**:
590
+ - `model`
591
+ - Note: Overlaps with `gen_ai.client.operation.duration` (GenAI conventions).
592
+
593
+ ##### Token usage
594
+
595
+ Tracks tokens used by model and type.
596
+
597
+ - `gemini_cli.token.usage` (Counter, Int): Counts tokens used.
598
+ - **Attributes**:
599
+ - `model`
600
+ - `type` ("input", "output", "thought", "cache", or "tool")
601
+ - Note: Overlaps with `gen_ai.client.token.usage` for `input`/`output`.
602
+
603
+ ##### Files
604
+
605
+ Counts file operations with basic context.
606
+
607
+ - `gemini_cli.file.operation.count` (Counter, Int): Counts file operations.
608
+ - **Attributes**:
609
+ - `operation` ("create", "read", "update")
610
+ - `lines` (Int, optional)
611
+ - `mimetype` (string, optional)
612
+ - `extension` (string, optional)
613
+ - `programming_language` (string, optional)
614
+
615
+ - `gemini_cli.lines.changed` (Counter, Int): Number of lines changed (from file
616
+ diffs).
617
+ - **Attributes**:
618
+ - `function_name`
619
+ - `type` ("added" or "removed")
620
+
621
+ ##### Chat and streaming
622
+
623
+ Resilience counters for compression, invalid chunks, and retries.
624
+
625
+ - `gemini_cli.chat_compression` (Counter, Int): Counts chat compression
626
+ operations.
627
+ - **Attributes**:
628
+ - `tokens_before` (Int)
629
+ - `tokens_after` (Int)
630
+
631
+ - `gemini_cli.chat.invalid_chunk.count` (Counter, Int): Counts invalid chunks
632
+ from streams.
633
+
634
+ - `gemini_cli.chat.content_retry.count` (Counter, Int): Counts retries due to
635
+ content errors.
636
+
637
+ - `gemini_cli.chat.content_retry_failure.count` (Counter, Int): Counts requests
638
+ where all content retries failed.
639
+
640
+ ##### Model routing
641
+
642
+ Routing latency/failures and slash-command selections.
643
+
644
+ - `gemini_cli.slash_command.model.call_count` (Counter, Int): Counts model
645
+ selections via slash command.
646
+ - **Attributes**:
647
+ - `slash_command.model.model_name` (string)
648
+
649
+ - `gemini_cli.model_routing.latency` (Histogram, ms): Model routing decision
650
+ latency.
651
+ - **Attributes**:
652
+ - `routing.decision_model` (string)
653
+ - `routing.decision_source` (string)
654
+
655
+ - `gemini_cli.model_routing.failure.count` (Counter, Int): Counts model routing
656
+ failures.
657
+ - **Attributes**:
658
+ - `routing.decision_source` (string)
659
+ - `routing.error_message` (string)
660
+
661
+ ##### Agent runs
662
+
663
+ Agent lifecycle metrics: runs, durations, and turns.
664
+
665
+ - `gemini_cli.agent.run.count` (Counter, Int): Counts agent runs.
666
+ - **Attributes**:
667
+ - `agent_name` (string)
668
+ - `terminate_reason` (string)
669
+
670
+ - `gemini_cli.agent.duration` (Histogram, ms): Agent run durations.
671
+ - **Attributes**:
672
+ - `agent_name` (string)
673
+
674
+ - `gemini_cli.agent.turns` (Histogram, turns): Turns taken per agent run.
675
+ - **Attributes**:
676
+ - `agent_name` (string)
677
+
678
+ ##### UI
679
+
680
+ UI stability signals such as flicker count.
681
+
682
+ - `gemini_cli.ui.flicker.count` (Counter, Int): Counts UI frames that flicker
683
+ (render taller than terminal).
684
+
685
+ ##### Performance
686
+
687
+ Optional performance monitoring for startup, CPU/memory, and phase timing.
688
+
689
+ - `gemini_cli.startup.duration` (Histogram, ms): CLI startup time by phase.
690
+ - **Attributes**:
691
+ - `phase` (string)
692
+ - `details` (map, optional)
693
+
694
+ - `gemini_cli.memory.usage` (Histogram, bytes): Memory usage.
695
+ - **Attributes**:
696
+ - `memory_type` ("heap_used", "heap_total", "external", "rss")
697
+ - `component` (string, optional)
698
+
699
+ - `gemini_cli.cpu.usage` (Histogram, percent): CPU usage percentage.
700
+ - **Attributes**:
701
+ - `component` (string, optional)
702
+
703
+ - `gemini_cli.tool.queue.depth` (Histogram, count): Number of tools in the
704
+ execution queue.
705
+
706
+ - `gemini_cli.tool.execution.breakdown` (Histogram, ms): Tool time by phase.
707
+ - **Attributes**:
708
+ - `function_name` (string)
709
+ - `phase` ("validation", "preparation", "execution", "result_processing")
710
+
711
+ - `gemini_cli.api.request.breakdown` (Histogram, ms): API request time by phase.
712
+ - **Attributes**:
713
+ - `model` (string)
714
+ - `phase` ("request_preparation", "network_latency", "response_processing",
715
+ "token_processing")
716
+
717
+ - `gemini_cli.token.efficiency` (Histogram, ratio): Token efficiency metrics.
718
+ - **Attributes**:
719
+ - `model` (string)
720
+ - `metric` (string)
721
+ - `context` (string, optional)
722
+
723
+ - `gemini_cli.performance.score` (Histogram, score): Composite performance
724
+ score.
725
+ - **Attributes**:
726
+ - `category` (string)
727
+ - `baseline` (number, optional)
728
+
729
+ - `gemini_cli.performance.regression` (Counter, Int): Regression detection
730
+ events.
731
+ - **Attributes**:
732
+ - `metric` (string)
733
+ - `severity` ("low", "medium", "high")
734
+ - `current_value` (number)
735
+ - `baseline_value` (number)
736
+
737
+ - `gemini_cli.performance.regression.percentage_change` (Histogram, percent):
738
+ Percent change from baseline when regression detected.
739
+ - **Attributes**:
740
+ - `metric` (string)
741
+ - `severity` ("low", "medium", "high")
742
+ - `current_value` (number)
743
+ - `baseline_value` (number)
744
+
745
+ - `gemini_cli.performance.baseline.comparison` (Histogram, percent): Comparison
746
+ to baseline.
747
+ - **Attributes**:
748
+ - `metric` (string)
749
+ - `category` (string)
750
+ - `current_value` (number)
751
+ - `baseline_value` (number)
752
+
753
+ #### GenAI semantic convention
754
+
755
+ The following metrics comply with [OpenTelemetry GenAI semantic conventions] for
756
+ standardized observability across GenAI applications:
757
+
758
+ - `gen_ai.client.token.usage` (Histogram, token): Number of input and output
759
+ tokens used per operation.
760
+ - **Attributes**:
761
+ - `gen_ai.operation.name` (string): The operation type (e.g.,
762
+ "generate_content", "chat")
763
+ - `gen_ai.provider.name` (string): The GenAI provider ("gcp.gen_ai" or
764
+ "gcp.vertex_ai")
765
+ - `gen_ai.token.type` (string): The token type ("input" or "output")
766
+ - `gen_ai.request.model` (string, optional): The model name used for the
767
+ request
768
+ - `gen_ai.response.model` (string, optional): The model name that generated
769
+ the response
770
+ - `server.address` (string, optional): GenAI server address
771
+ - `server.port` (int, optional): GenAI server port
772
+
773
+ - `gen_ai.client.operation.duration` (Histogram, s): GenAI operation duration in
774
+ seconds.
775
+ - **Attributes**:
776
+ - `gen_ai.operation.name` (string): The operation type (e.g.,
777
+ "generate_content", "chat")
778
+ - `gen_ai.provider.name` (string): The GenAI provider ("gcp.gen_ai" or
779
+ "gcp.vertex_ai")
780
+ - `gen_ai.request.model` (string, optional): The model name used for the
781
+ request
782
+ - `gen_ai.response.model` (string, optional): The model name that generated
783
+ the response
784
+ - `server.address` (string, optional): GenAI server address
785
+ - `server.port` (int, optional): GenAI server port
786
+ - `error.type` (string, optional): Error type if the operation failed
787
+
788
+ [OpenTelemetry GenAI semantic conventions]:
789
+ https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-metrics.md
790
+ [OpenTelemetry GenAI semantic conventions for events]:
791
+ https://github.com/open-telemetry/semantic-conventions/blob/8b4f210f43136e57c1f6f47292eb6d38e3bf30bb/docs/gen-ai/gen-ai-events.md