@dgxo/mashadevcli 1.1.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 (140) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +393 -0
  3. package/bundle/builtin/skill-creator/SKILL.md +382 -0
  4. package/bundle/builtin/skill-creator/scripts/init_skill.cjs +239 -0
  5. package/bundle/builtin/skill-creator/scripts/package_skill.cjs +131 -0
  6. package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +131 -0
  7. package/bundle/docs/CONTRIBUTING.md +1 -0
  8. package/bundle/docs/admin/enterprise-controls.md +115 -0
  9. package/bundle/docs/assets/connected_devtools.png +0 -0
  10. package/bundle/docs/assets/gemini-screenshot.png +0 -0
  11. package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
  12. package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
  13. package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
  14. package/bundle/docs/assets/release_patch.png +0 -0
  15. package/bundle/docs/assets/theme-ansi-light.png +0 -0
  16. package/bundle/docs/assets/theme-ansi.png +0 -0
  17. package/bundle/docs/assets/theme-atom-one.png +0 -0
  18. package/bundle/docs/assets/theme-ayu-light.png +0 -0
  19. package/bundle/docs/assets/theme-ayu.png +0 -0
  20. package/bundle/docs/assets/theme-custom.png +0 -0
  21. package/bundle/docs/assets/theme-default-light.png +0 -0
  22. package/bundle/docs/assets/theme-default.png +0 -0
  23. package/bundle/docs/assets/theme-dracula.png +0 -0
  24. package/bundle/docs/assets/theme-github-light.png +0 -0
  25. package/bundle/docs/assets/theme-github.png +0 -0
  26. package/bundle/docs/assets/theme-google-light.png +0 -0
  27. package/bundle/docs/assets/theme-xcode-light.png +0 -0
  28. package/bundle/docs/changelogs/index.md +867 -0
  29. package/bundle/docs/changelogs/latest.md +208 -0
  30. package/bundle/docs/changelogs/preview.md +187 -0
  31. package/bundle/docs/cli/checkpointing.md +93 -0
  32. package/bundle/docs/cli/cli-reference.md +115 -0
  33. package/bundle/docs/cli/creating-skills.md +80 -0
  34. package/bundle/docs/cli/custom-commands.md +327 -0
  35. package/bundle/docs/cli/enterprise.md +604 -0
  36. package/bundle/docs/cli/gemini-ignore.md +71 -0
  37. package/bundle/docs/cli/gemini-md.md +116 -0
  38. package/bundle/docs/cli/generation-settings.md +210 -0
  39. package/bundle/docs/cli/headless.md +50 -0
  40. package/bundle/docs/cli/model-routing.md +42 -0
  41. package/bundle/docs/cli/model.md +53 -0
  42. package/bundle/docs/cli/plan-mode.md +375 -0
  43. package/bundle/docs/cli/rewind.md +51 -0
  44. package/bundle/docs/cli/sandbox.md +257 -0
  45. package/bundle/docs/cli/session-management.md +184 -0
  46. package/bundle/docs/cli/settings.md +165 -0
  47. package/bundle/docs/cli/skills.md +134 -0
  48. package/bundle/docs/cli/system-prompt.md +125 -0
  49. package/bundle/docs/cli/telemetry.md +922 -0
  50. package/bundle/docs/cli/themes.md +269 -0
  51. package/bundle/docs/cli/token-caching.md +20 -0
  52. package/bundle/docs/cli/trusted-folders.md +126 -0
  53. package/bundle/docs/cli/tutorials/automation.md +283 -0
  54. package/bundle/docs/cli/tutorials/file-management.md +142 -0
  55. package/bundle/docs/cli/tutorials/mcp-setup.md +113 -0
  56. package/bundle/docs/cli/tutorials/memory-management.md +126 -0
  57. package/bundle/docs/cli/tutorials/session-management.md +105 -0
  58. package/bundle/docs/cli/tutorials/shell-commands.md +107 -0
  59. package/bundle/docs/cli/tutorials/skills-getting-started.md +110 -0
  60. package/bundle/docs/cli/tutorials/task-planning.md +93 -0
  61. package/bundle/docs/cli/tutorials/web-tools.md +78 -0
  62. package/bundle/docs/core/index.md +107 -0
  63. package/bundle/docs/core/remote-agents.md +84 -0
  64. package/bundle/docs/core/subagents.md +307 -0
  65. package/bundle/docs/examples/proxy-script.md +83 -0
  66. package/bundle/docs/extensions/best-practices.md +188 -0
  67. package/bundle/docs/extensions/index.md +61 -0
  68. package/bundle/docs/extensions/reference.md +333 -0
  69. package/bundle/docs/extensions/releasing.md +154 -0
  70. package/bundle/docs/extensions/writing-extensions.md +308 -0
  71. package/bundle/docs/get-started/authentication.md +402 -0
  72. package/bundle/docs/get-started/examples.md +139 -0
  73. package/bundle/docs/get-started/gemini-3.md +115 -0
  74. package/bundle/docs/get-started/index.md +82 -0
  75. package/bundle/docs/get-started/installation.md +174 -0
  76. package/bundle/docs/hooks/best-practices.md +709 -0
  77. package/bundle/docs/hooks/index.md +164 -0
  78. package/bundle/docs/hooks/reference.md +330 -0
  79. package/bundle/docs/hooks/writing-hooks.md +474 -0
  80. package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
  81. package/bundle/docs/ide-integration/index.md +224 -0
  82. package/bundle/docs/index.md +141 -0
  83. package/bundle/docs/integration-tests.md +211 -0
  84. package/bundle/docs/issue-and-pr-automation.md +172 -0
  85. package/bundle/docs/local-development.md +134 -0
  86. package/bundle/docs/mermaid/context.mmd +103 -0
  87. package/bundle/docs/mermaid/render-path.mmd +64 -0
  88. package/bundle/docs/npm.md +62 -0
  89. package/bundle/docs/redirects.json +20 -0
  90. package/bundle/docs/reference/commands.md +526 -0
  91. package/bundle/docs/reference/configuration.md +1786 -0
  92. package/bundle/docs/reference/keyboard-shortcuts.md +164 -0
  93. package/bundle/docs/reference/memport.md +246 -0
  94. package/bundle/docs/reference/policy-engine.md +364 -0
  95. package/bundle/docs/reference/tools.md +106 -0
  96. package/bundle/docs/release-confidence.md +164 -0
  97. package/bundle/docs/releases.md +540 -0
  98. package/bundle/docs/resources/faq.md +175 -0
  99. package/bundle/docs/resources/quota-and-pricing.md +165 -0
  100. package/bundle/docs/resources/tos-privacy.md +102 -0
  101. package/bundle/docs/resources/troubleshooting.md +176 -0
  102. package/bundle/docs/resources/uninstall.md +56 -0
  103. package/bundle/docs/sidebar.json +233 -0
  104. package/bundle/docs/tools/activate-skill.md +43 -0
  105. package/bundle/docs/tools/ask-user.md +95 -0
  106. package/bundle/docs/tools/file-system.md +129 -0
  107. package/bundle/docs/tools/internal-docs.md +46 -0
  108. package/bundle/docs/tools/mcp-server.md +1150 -0
  109. package/bundle/docs/tools/memory.md +35 -0
  110. package/bundle/docs/tools/planning.md +58 -0
  111. package/bundle/docs/tools/shell.md +216 -0
  112. package/bundle/docs/tools/todos.md +35 -0
  113. package/bundle/docs/tools/web-fetch.md +35 -0
  114. package/bundle/docs/tools/web-search.md +32 -0
  115. package/bundle/docs/update/update-guide.md +111 -0
  116. package/bundle/masha.js +563471 -0
  117. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/client/main.js +89 -0
  118. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.d.ts +7 -0
  119. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js +9 -0
  120. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js.map +1 -0
  121. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.d.ts +48 -0
  122. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js +299 -0
  123. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js.map +1 -0
  124. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.d.ts +36 -0
  125. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js +7 -0
  126. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js.map +1 -0
  127. package/bundle/node_modules/@dgxo/mashadevcli-devtools/package.json +32 -0
  128. package/bundle/policies/conseca.toml +6 -0
  129. package/bundle/policies/discovered.toml +8 -0
  130. package/bundle/policies/plan.toml +109 -0
  131. package/bundle/policies/read-only.toml +53 -0
  132. package/bundle/policies/write.toml +80 -0
  133. package/bundle/policies/yolo.toml +54 -0
  134. package/bundle/sandbox-macos-permissive-open.sb +27 -0
  135. package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
  136. package/bundle/sandbox-macos-restrictive-open.sb +96 -0
  137. package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
  138. package/bundle/sandbox-macos-strict-open.sb +131 -0
  139. package/bundle/sandbox-macos-strict-proxied.sb +133 -0
  140. package/package.json +169 -0
@@ -0,0 +1,922 @@
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
+ - [Authenticating with CLI Credentials](#authenticating-with-cli-credentials)
12
+ - [Direct export (recommended)](#direct-export-recommended)
13
+ - [Collector-based export (advanced)](#collector-based-export-advanced)
14
+ - [Monitoring Dashboards](#monitoring-dashboards)
15
+ - [Local telemetry](#local-telemetry)
16
+ - [File-based output (recommended)](#file-based-output-recommended)
17
+ - [Collector-based export (advanced)](#collector-based-export-advanced-1)
18
+ - [Logs and metrics](#logs-and-metrics)
19
+ - [Logs](#logs)
20
+ - [Sessions](#sessions)
21
+ - [Approval Mode](#approval-mode)
22
+ - [Tools](#tools)
23
+ - [Files](#files)
24
+ - [API](#api)
25
+ - [Model routing](#model-routing)
26
+ - [Chat and streaming](#chat-and-streaming)
27
+ - [Resilience](#resilience)
28
+ - [Extensions](#extensions)
29
+ - [Agent runs](#agent-runs)
30
+ - [IDE](#ide)
31
+ - [UI](#ui)
32
+ - [Metrics](#metrics)
33
+ - [Custom](#custom)
34
+ - [Sessions](#sessions-1)
35
+ - [Tools](#tools-1)
36
+ - [API](#api-1)
37
+ - [Token usage](#token-usage)
38
+ - [Files](#files-1)
39
+ - [Chat and streaming](#chat-and-streaming-1)
40
+ - [Model routing](#model-routing-1)
41
+ - [Agent runs](#agent-runs-1)
42
+ - [UI](#ui-1)
43
+ - [Performance](#performance)
44
+ - [GenAI semantic convention](#genai-semantic-convention)
45
+
46
+ ## Key benefits
47
+
48
+ - **🔍 Usage analytics**: Understand interaction patterns and feature adoption
49
+ across your team
50
+ - **⚡ Performance monitoring**: Track response times, token consumption, and
51
+ resource utilization
52
+ - **🐛 Real-time debugging**: Identify bottlenecks, failures, and error patterns
53
+ as they occur
54
+ - **📊 Workflow optimization**: Make informed decisions to improve
55
+ configurations and processes
56
+ - **🏢 Enterprise governance**: Monitor usage across teams, track costs, ensure
57
+ compliance, and integrate with existing monitoring infrastructure
58
+
59
+ ## OpenTelemetry integration
60
+
61
+ Built on **[OpenTelemetry]** — the vendor-neutral, industry-standard
62
+ observability framework — Gemini CLI's observability system provides:
63
+
64
+ - **Universal compatibility**: Export to any OpenTelemetry backend (Google
65
+ Cloud, Jaeger, Prometheus, Datadog, etc.)
66
+ - **Standardized data**: Use consistent formats and collection methods across
67
+ your toolchain
68
+ - **Future-proof integration**: Connect with existing and future observability
69
+ infrastructure
70
+ - **No vendor lock-in**: Switch between backends without changing your
71
+ instrumentation
72
+
73
+ [OpenTelemetry]: https://opentelemetry.io/
74
+
75
+ ## Configuration
76
+
77
+ All telemetry behavior is controlled through your `.gemini/settings.json` file.
78
+ Environment variables can be used to override the settings in the file.
79
+
80
+ | Setting | Environment Variable | Description | Values | Default |
81
+ | -------------- | -------------------------------- | --------------------------------------------------- | ----------------- | ----------------------- |
82
+ | `enabled` | `GEMINI_TELEMETRY_ENABLED` | Enable or disable telemetry | `true`/`false` | `false` |
83
+ | `target` | `GEMINI_TELEMETRY_TARGET` | Where to send telemetry data | `"gcp"`/`"local"` | `"local"` |
84
+ | `otlpEndpoint` | `GEMINI_TELEMETRY_OTLP_ENDPOINT` | OTLP collector endpoint | URL string | `http://localhost:4317` |
85
+ | `otlpProtocol` | `GEMINI_TELEMETRY_OTLP_PROTOCOL` | OTLP transport protocol | `"grpc"`/`"http"` | `"grpc"` |
86
+ | `outfile` | `GEMINI_TELEMETRY_OUTFILE` | Save telemetry to file (overrides `otlpEndpoint`) | file path | - |
87
+ | `logPrompts` | `GEMINI_TELEMETRY_LOG_PROMPTS` | Include prompts in telemetry logs | `true`/`false` | `true` |
88
+ | `useCollector` | `GEMINI_TELEMETRY_USE_COLLECTOR` | Use external OTLP collector (advanced) | `true`/`false` | `false` |
89
+ | `useCliAuth` | `GEMINI_TELEMETRY_USE_CLI_AUTH` | Use CLI credentials for telemetry (GCP target only) | `true`/`false` | `false` |
90
+
91
+ **Note on boolean environment variables:** For the boolean settings (`enabled`,
92
+ `logPrompts`, `useCollector`), setting the corresponding environment variable to
93
+ `true` or `1` will enable the feature. Any other value will disable it.
94
+
95
+ For detailed information about all configuration options, see the
96
+ [Configuration guide](../reference/configuration.md).
97
+
98
+ ## Google Cloud telemetry
99
+
100
+ ### Prerequisites
101
+
102
+ Before using either method below, complete these steps:
103
+
104
+ 1. Set your Google Cloud project ID:
105
+ - For telemetry in a separate project from inference:
106
+
107
+ **macOS/Linux**
108
+
109
+ ```bash
110
+ export OTLP_GOOGLE_CLOUD_PROJECT="your-telemetry-project-id"
111
+ ```
112
+
113
+ **Windows (PowerShell)**
114
+
115
+ ```powershell
116
+ $env:OTLP_GOOGLE_CLOUD_PROJECT="your-telemetry-project-id"
117
+ ```
118
+
119
+ - For telemetry in the same project as inference:
120
+
121
+ **macOS/Linux**
122
+
123
+ ```bash
124
+ export GOOGLE_CLOUD_PROJECT="your-project-id"
125
+ ```
126
+
127
+ **Windows (PowerShell)**
128
+
129
+ ```powershell
130
+ $env:GOOGLE_CLOUD_PROJECT="your-project-id"
131
+ ```
132
+
133
+ 2. Authenticate with Google Cloud:
134
+ - If using a user account:
135
+ ```bash
136
+ gcloud auth application-default login
137
+ ```
138
+ - If using a service account:
139
+
140
+ **macOS/Linux**
141
+
142
+ ```bash
143
+ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account.json"
144
+ ```
145
+
146
+ **Windows (PowerShell)**
147
+
148
+ ```powershell
149
+ $env:GOOGLE_APPLICATION_CREDENTIALS="C:\path\to\your\service-account.json"
150
+ ```
151
+
152
+ 3. Make sure your account or service account has these IAM roles:
153
+ - Cloud Trace Agent
154
+ - Monitoring Metric Writer
155
+ - Logs Writer
156
+
157
+ 4. Enable the required Google Cloud APIs (if not already enabled):
158
+ ```bash
159
+ gcloud services enable \
160
+ cloudtrace.googleapis.com \
161
+ monitoring.googleapis.com \
162
+ logging.googleapis.com \
163
+ --project="$OTLP_GOOGLE_CLOUD_PROJECT"
164
+ ```
165
+
166
+ ### Authenticating with CLI Credentials
167
+
168
+ By default, the telemetry collector for Google Cloud uses Application Default
169
+ Credentials (ADC). However, you can configure it to use the same OAuth
170
+ credentials that you use to log in to the Gemini CLI. This is useful in
171
+ environments where you don't have ADC set up.
172
+
173
+ To enable this, set the `useCliAuth` property in your `telemetry` settings to
174
+ `true`:
175
+
176
+ ```json
177
+ {
178
+ "telemetry": {
179
+ "enabled": true,
180
+ "target": "gcp",
181
+ "useCliAuth": true
182
+ }
183
+ }
184
+ ```
185
+
186
+ **Important:**
187
+
188
+ - This setting requires the use of **Direct Export** (in-process exporters).
189
+ - It **cannot** be used with `useCollector: true`. If you enable both, telemetry
190
+ will be disabled and an error will be logged.
191
+ - The CLI will automatically use your credentials to authenticate with Google
192
+ Cloud Trace, Metrics, and Logging APIs.
193
+
194
+ ### Direct export (recommended)
195
+
196
+ Sends telemetry directly to Google Cloud services. No collector needed.
197
+
198
+ 1. Enable telemetry in your `.gemini/settings.json`:
199
+ ```json
200
+ {
201
+ "telemetry": {
202
+ "enabled": true,
203
+ "target": "gcp"
204
+ }
205
+ }
206
+ ```
207
+ 2. Run Gemini CLI and send prompts.
208
+ 3. View logs, metrics, and traces:
209
+ - Open the Google Cloud Console in your browser after sending prompts:
210
+ - Logs (Logs Explorer): https://console.cloud.google.com/logs/
211
+ - Metrics (Metrics Explorer):
212
+ https://console.cloud.google.com/monitoring/metrics-explorer
213
+ - Traces (Trace Explorer): https://console.cloud.google.com/traces/list
214
+
215
+ ### Collector-based export (advanced)
216
+
217
+ For custom processing, filtering, or routing, use an OpenTelemetry collector to
218
+ forward data to Google Cloud.
219
+
220
+ 1. Configure your `.gemini/settings.json`:
221
+ ```json
222
+ {
223
+ "telemetry": {
224
+ "enabled": true,
225
+ "target": "gcp",
226
+ "useCollector": true
227
+ }
228
+ }
229
+ ```
230
+ 2. Run the automation script:
231
+ ```bash
232
+ npm run telemetry -- --target=gcp
233
+ ```
234
+ This will:
235
+ - Start a local OTEL collector that forwards to Google Cloud
236
+ - Configure your workspace
237
+ - Provide links to view traces, metrics, and logs in Google Cloud Console
238
+ - Save collector logs to `~/.gemini/tmp/<projectHash>/otel/collector-gcp.log`
239
+ - Stop collector on exit (e.g. `Ctrl+C`)
240
+ 3. Run Gemini CLI and send prompts.
241
+ 4. View logs, metrics, and traces:
242
+ - Open the Google Cloud Console in your browser after sending prompts:
243
+ - Logs (Logs Explorer): https://console.cloud.google.com/logs/
244
+ - Metrics (Metrics Explorer):
245
+ https://console.cloud.google.com/monitoring/metrics-explorer
246
+ - Traces (Trace Explorer): https://console.cloud.google.com/traces/list
247
+ - Open `~/.gemini/tmp/<projectHash>/otel/collector-gcp.log` to view local
248
+ collector logs.
249
+
250
+ ### Monitoring Dashboards
251
+
252
+ Gemini CLI provides a pre-configured
253
+ [Google Cloud Monitoring](https://cloud.google.com/monitoring) dashboard to
254
+ visualize your telemetry.
255
+
256
+ This dashboard can be found under **Google Cloud Monitoring Dashboard
257
+ Templates** as "**Gemini CLI Monitoring**".
258
+
259
+ ![Gemini CLI Monitoring Dashboard Overview](/docs/assets/monitoring-dashboard-overview.png)
260
+
261
+ ![Gemini CLI Monitoring Dashboard Metrics](/docs/assets/monitoring-dashboard-metrics.png)
262
+
263
+ ![Gemini CLI Monitoring Dashboard Logs](/docs/assets/monitoring-dashboard-logs.png)
264
+
265
+ To learn more, check out this blog post:
266
+ [Instant insights: Gemini CLI’s new pre-configured monitoring dashboards](https://cloud.google.com/blog/topics/developers-practitioners/instant-insights-gemini-clis-new-pre-configured-monitoring-dashboards/).
267
+
268
+ ## Local telemetry
269
+
270
+ For local development and debugging, you can capture telemetry data locally:
271
+
272
+ ### File-based output (recommended)
273
+
274
+ 1. Enable telemetry in your `.gemini/settings.json`:
275
+ ```json
276
+ {
277
+ "telemetry": {
278
+ "enabled": true,
279
+ "target": "local",
280
+ "otlpEndpoint": "",
281
+ "outfile": ".gemini/telemetry.log"
282
+ }
283
+ }
284
+ ```
285
+ 2. Run Gemini CLI and send prompts.
286
+ 3. View logs and metrics in the specified file (e.g., `.gemini/telemetry.log`).
287
+
288
+ ### Collector-based export (advanced)
289
+
290
+ 1. Run the automation script:
291
+ ```bash
292
+ npm run telemetry -- --target=local
293
+ ```
294
+ This will:
295
+ - Download and start Jaeger and OTEL collector
296
+ - Configure your workspace for local telemetry
297
+ - Provide a Jaeger UI at http://localhost:16686
298
+ - Save logs/metrics to `~/.gemini/tmp/<projectHash>/otel/collector.log`
299
+ - Stop collector on exit (e.g. `Ctrl+C`)
300
+ 2. Run Gemini CLI and send prompts.
301
+ 3. View traces at http://localhost:16686 and logs/metrics in the collector log
302
+ file.
303
+
304
+ ## Logs, metrics, and traces
305
+
306
+ The following section describes the structure of logs, metrics, and traces
307
+ generated for Gemini CLI.
308
+
309
+ The `session.id`, `installation.id`, `active_approval_mode`, and `user.email`
310
+ (available only when authenticated with a Google account) are included as common
311
+ attributes on all logs and metrics.
312
+
313
+ ### Logs
314
+
315
+ Logs are timestamped records of specific events. The following events are logged
316
+ for Gemini CLI, grouped by category.
317
+
318
+ #### Sessions
319
+
320
+ Captures startup configuration and user prompt submissions.
321
+
322
+ - `gemini_cli.config`: Emitted once at startup with the CLI configuration.
323
+ - **Attributes**:
324
+ - `model` (string)
325
+ - `embedding_model` (string)
326
+ - `sandbox_enabled` (boolean)
327
+ - `core_tools_enabled` (string)
328
+ - `approval_mode` (string)
329
+ - `api_key_enabled` (boolean)
330
+ - `vertex_ai_enabled` (boolean)
331
+ - `log_user_prompts_enabled` (boolean)
332
+ - `file_filtering_respect_git_ignore` (boolean)
333
+ - `debug_mode` (boolean)
334
+ - `mcp_servers` (string)
335
+ - `mcp_servers_count` (int)
336
+ - `extensions` (string)
337
+ - `extension_ids` (string)
338
+ - `extension_count` (int)
339
+ - `mcp_tools` (string, if applicable)
340
+ - `mcp_tools_count` (int, if applicable)
341
+ - `output_format` ("text", "json", or "stream-json")
342
+
343
+ - `gemini_cli.user_prompt`: Emitted when a user submits a prompt.
344
+ - **Attributes**:
345
+ - `prompt_length` (int)
346
+ - `prompt_id` (string)
347
+ - `prompt` (string; excluded if `telemetry.logPrompts` is `false`)
348
+ - `auth_type` (string)
349
+
350
+ #### Approval Mode
351
+
352
+ Tracks changes and duration of approval modes.
353
+
354
+ ##### Lifecycle
355
+
356
+ - `approval_mode_switch`: Approval mode was changed.
357
+ - **Attributes**:
358
+ - `from_mode` (string)
359
+ - `to_mode` (string)
360
+
361
+ - `approval_mode_duration`: Duration spent in an approval mode.
362
+ - **Attributes**:
363
+ - `mode` (string)
364
+ - `duration_ms` (int)
365
+
366
+ ##### Execution
367
+
368
+ These events track the execution of an approval mode, such as Plan Mode.
369
+
370
+ - `plan_execution`: A plan was executed and the session switched from plan mode
371
+ to active execution.
372
+ - **Attributes**:
373
+ - `approval_mode` (string)
374
+
375
+ #### Tools
376
+
377
+ Captures tool executions, output truncation, and Edit behavior.
378
+
379
+ - `gemini_cli.tool_call`: Emitted for each tool (function) call.
380
+ - **Attributes**:
381
+ - `function_name`
382
+ - `function_args`
383
+ - `duration_ms`
384
+ - `success` (boolean)
385
+ - `decision` ("accept", "reject", "auto_accept", or "modify", if applicable)
386
+ - `error` (if applicable)
387
+ - `error_type` (if applicable)
388
+ - `prompt_id` (string)
389
+ - `tool_type` ("native" or "mcp")
390
+ - `mcp_server_name` (string, if applicable)
391
+ - `extension_name` (string, if applicable)
392
+ - `extension_id` (string, if applicable)
393
+ - `content_length` (int, if applicable)
394
+ - `metadata` (if applicable), which includes for the `AskUser` tool:
395
+ - `ask_user` (object):
396
+ - `question_types` (array of strings)
397
+ - `ask_user_dismissed` (boolean)
398
+ - `ask_user_empty_submission` (boolean)
399
+ - `ask_user_answer_count` (number)
400
+ - `diffStat` (if applicable), which includes:
401
+ - `model_added_lines` (number)
402
+ - `model_removed_lines` (number)
403
+ - `model_added_chars` (number)
404
+ - `model_removed_chars` (number)
405
+ - `user_added_lines` (number)
406
+ - `user_removed_lines` (number)
407
+ - `user_added_chars` (number)
408
+ - `user_removed_chars` (number)
409
+
410
+ - `gemini_cli.tool_output_truncated`: Output of a tool call was truncated.
411
+ - **Attributes**:
412
+ - `tool_name` (string)
413
+ - `original_content_length` (int)
414
+ - `truncated_content_length` (int)
415
+ - `threshold` (int)
416
+ - `lines` (int)
417
+ - `prompt_id` (string)
418
+
419
+ - `gemini_cli.edit_strategy`: Edit strategy chosen.
420
+ - **Attributes**:
421
+ - `strategy` (string)
422
+
423
+ - `gemini_cli.edit_correction`: Edit correction result.
424
+ - **Attributes**:
425
+ - `correction` ("success" | "failure")
426
+
427
+ - `gen_ai.client.inference.operation.details`: This event provides detailed
428
+ information about the GenAI operation, aligned with [OpenTelemetry GenAI
429
+ semantic conventions for events].
430
+ - **Attributes**:
431
+ - `gen_ai.request.model` (string)
432
+ - `gen_ai.provider.name` (string)
433
+ - `gen_ai.operation.name` (string)
434
+ - `gen_ai.input.messages` (json string)
435
+ - `gen_ai.output.messages` (json string)
436
+ - `gen_ai.response.finish_reasons` (array of strings)
437
+ - `gen_ai.usage.input_tokens` (int)
438
+ - `gen_ai.usage.output_tokens` (int)
439
+ - `gen_ai.request.temperature` (float)
440
+ - `gen_ai.request.top_p` (float)
441
+ - `gen_ai.request.top_k` (int)
442
+ - `gen_ai.request.max_tokens` (int)
443
+ - `gen_ai.system_instructions` (json string)
444
+ - `server.address` (string)
445
+ - `server.port` (int)
446
+
447
+ #### Files
448
+
449
+ Tracks file operations performed by tools.
450
+
451
+ - `gemini_cli.file_operation`: Emitted for each file operation.
452
+ - **Attributes**:
453
+ - `tool_name` (string)
454
+ - `operation` ("create" | "read" | "update")
455
+ - `lines` (int, optional)
456
+ - `mimetype` (string, optional)
457
+ - `extension` (string, optional)
458
+ - `programming_language` (string, optional)
459
+
460
+ #### API
461
+
462
+ Captures Gemini API requests, responses, and errors.
463
+
464
+ - `gemini_cli.api_request`: Request sent to Gemini API.
465
+ - **Attributes**:
466
+ - `model` (string)
467
+ - `prompt_id` (string)
468
+ - `request_text` (string, optional)
469
+
470
+ - `gemini_cli.api_response`: Response received from Gemini API.
471
+ - **Attributes**:
472
+ - `model` (string)
473
+ - `status_code` (int|string)
474
+ - `duration_ms` (int)
475
+ - `input_token_count` (int)
476
+ - `output_token_count` (int)
477
+ - `cached_content_token_count` (int)
478
+ - `thoughts_token_count` (int)
479
+ - `tool_token_count` (int)
480
+ - `total_token_count` (int)
481
+ - `response_text` (string, optional)
482
+ - `prompt_id` (string)
483
+ - `auth_type` (string)
484
+ - `finish_reasons` (array of strings)
485
+
486
+ - `gemini_cli.api_error`: API request failed.
487
+ - **Attributes**:
488
+ - `model` (string)
489
+ - `error` (string)
490
+ - `error_type` (string)
491
+ - `status_code` (int|string)
492
+ - `duration_ms` (int)
493
+ - `prompt_id` (string)
494
+ - `auth_type` (string)
495
+
496
+ - `gemini_cli.malformed_json_response`: `generateJson` response could not be
497
+ parsed.
498
+ - **Attributes**:
499
+ - `model` (string)
500
+
501
+ #### Model routing
502
+
503
+ - `gemini_cli.slash_command`: A slash command was executed.
504
+ - **Attributes**:
505
+ - `command` (string)
506
+ - `subcommand` (string, optional)
507
+ - `status` ("success" | "error")
508
+
509
+ - `gemini_cli.slash_command.model`: Model was selected via slash command.
510
+ - **Attributes**:
511
+ - `model_name` (string)
512
+
513
+ - `gemini_cli.model_routing`: Model router made a decision.
514
+ - **Attributes**:
515
+ - `decision_model` (string)
516
+ - `decision_source` (string)
517
+ - `routing_latency_ms` (int)
518
+ - `reasoning` (string, optional)
519
+ - `failed` (boolean)
520
+ - `error_message` (string, optional)
521
+ - `approval_mode` (string)
522
+
523
+ #### Chat and streaming
524
+
525
+ - `gemini_cli.chat_compression`: Chat context was compressed.
526
+ - **Attributes**:
527
+ - `tokens_before` (int)
528
+ - `tokens_after` (int)
529
+
530
+ - `gemini_cli.chat.invalid_chunk`: Invalid chunk received from a stream.
531
+ - **Attributes**:
532
+ - `error.message` (string, optional)
533
+
534
+ - `gemini_cli.chat.content_retry`: Retry triggered due to a content error.
535
+ - **Attributes**:
536
+ - `attempt_number` (int)
537
+ - `error_type` (string)
538
+ - `retry_delay_ms` (int)
539
+ - `model` (string)
540
+
541
+ - `gemini_cli.chat.content_retry_failure`: All content retries failed.
542
+ - **Attributes**:
543
+ - `total_attempts` (int)
544
+ - `final_error_type` (string)
545
+ - `total_duration_ms` (int, optional)
546
+ - `model` (string)
547
+
548
+ - `gemini_cli.conversation_finished`: Conversation session ended.
549
+ - **Attributes**:
550
+ - `approvalMode` (string)
551
+ - `turnCount` (int)
552
+
553
+ - `gemini_cli.next_speaker_check`: Next speaker determination.
554
+ - **Attributes**:
555
+ - `prompt_id` (string)
556
+ - `finish_reason` (string)
557
+ - `result` (string)
558
+
559
+ #### Resilience
560
+
561
+ Records fallback mechanisms for models and network operations.
562
+
563
+ - `gemini_cli.flash_fallback`: Switched to a flash model as fallback.
564
+ - **Attributes**:
565
+ - `auth_type` (string)
566
+
567
+ - `gemini_cli.ripgrep_fallback`: Switched to grep as fallback for file search.
568
+ - **Attributes**:
569
+ - `error` (string, optional)
570
+
571
+ - `gemini_cli.web_fetch_fallback_attempt`: Attempted web-fetch fallback.
572
+ - **Attributes**:
573
+ - `reason` ("private_ip" | "primary_failed")
574
+
575
+ #### Extensions
576
+
577
+ Tracks extension lifecycle and settings changes.
578
+
579
+ - `gemini_cli.extension_install`: An extension was installed.
580
+ - **Attributes**:
581
+ - `extension_name` (string)
582
+ - `extension_version` (string)
583
+ - `extension_source` (string)
584
+ - `status` (string)
585
+
586
+ - `gemini_cli.extension_uninstall`: An extension was uninstalled.
587
+ - **Attributes**:
588
+ - `extension_name` (string)
589
+ - `status` (string)
590
+
591
+ - `gemini_cli.extension_enable`: An extension was enabled.
592
+ - **Attributes**:
593
+ - `extension_name` (string)
594
+ - `setting_scope` (string)
595
+
596
+ - `gemini_cli.extension_disable`: An extension was disabled.
597
+ - **Attributes**:
598
+ - `extension_name` (string)
599
+ - `setting_scope` (string)
600
+
601
+ - `gemini_cli.extension_update`: An extension was updated.
602
+ - **Attributes**:
603
+ - `extension_name` (string)
604
+ - `extension_version` (string)
605
+ - `extension_previous_version` (string)
606
+ - `extension_source` (string)
607
+ - `status` (string)
608
+
609
+ #### Agent runs
610
+
611
+ - `gemini_cli.agent.start`: Agent run started.
612
+ - **Attributes**:
613
+ - `agent_id` (string)
614
+ - `agent_name` (string)
615
+
616
+ - `gemini_cli.agent.finish`: Agent run finished.
617
+ - **Attributes**:
618
+ - `agent_id` (string)
619
+ - `agent_name` (string)
620
+ - `duration_ms` (int)
621
+ - `turn_count` (int)
622
+ - `terminate_reason` (string)
623
+
624
+ #### IDE
625
+
626
+ Captures IDE connectivity and conversation lifecycle events.
627
+
628
+ - `gemini_cli.ide_connection`: IDE companion connection.
629
+ - **Attributes**:
630
+ - `connection_type` (string)
631
+
632
+ #### UI
633
+
634
+ Tracks terminal rendering issues and related signals.
635
+
636
+ - `kitty_sequence_overflow`: Terminal kitty control sequence overflow.
637
+ - **Attributes**:
638
+ - `sequence_length` (int)
639
+ - `truncated_sequence` (string)
640
+
641
+ ### Metrics
642
+
643
+ Metrics are numerical measurements of behavior over time.
644
+
645
+ #### Custom
646
+
647
+ ##### Sessions
648
+
649
+ Counts CLI sessions at startup.
650
+
651
+ - `gemini_cli.session.count` (Counter, Int): Incremented once per CLI startup.
652
+
653
+ ##### Tools
654
+
655
+ Measures tool usage and latency.
656
+
657
+ - `gemini_cli.tool.call.count` (Counter, Int): Counts tool calls.
658
+ - **Attributes**:
659
+ - `function_name`
660
+ - `success` (boolean)
661
+ - `decision` (string: "accept", "reject", "modify", or "auto_accept", if
662
+ applicable)
663
+ - `tool_type` (string: "mcp" or "native", if applicable)
664
+
665
+ - `gemini_cli.tool.call.latency` (Histogram, ms): Measures tool call latency.
666
+ - **Attributes**:
667
+ - `function_name`
668
+
669
+ ##### API
670
+
671
+ Tracks API request volume and latency.
672
+
673
+ - `gemini_cli.api.request.count` (Counter, Int): Counts all API requests.
674
+ - **Attributes**:
675
+ - `model`
676
+ - `status_code`
677
+ - `error_type` (if applicable)
678
+
679
+ - `gemini_cli.api.request.latency` (Histogram, ms): Measures API request
680
+ latency.
681
+ - **Attributes**:
682
+ - `model`
683
+ - Note: Overlaps with `gen_ai.client.operation.duration` (GenAI conventions).
684
+
685
+ ##### Token usage
686
+
687
+ Tracks tokens used by model and type.
688
+
689
+ - `gemini_cli.token.usage` (Counter, Int): Counts tokens used.
690
+ - **Attributes**:
691
+ - `model`
692
+ - `type` ("input", "output", "thought", "cache", or "tool")
693
+ - Note: Overlaps with `gen_ai.client.token.usage` for `input`/`output`.
694
+
695
+ ##### Files
696
+
697
+ Counts file operations with basic context.
698
+
699
+ - `gemini_cli.file.operation.count` (Counter, Int): Counts file operations.
700
+ - **Attributes**:
701
+ - `operation` ("create", "read", "update")
702
+ - `lines` (Int, optional)
703
+ - `mimetype` (string, optional)
704
+ - `extension` (string, optional)
705
+ - `programming_language` (string, optional)
706
+
707
+ - `gemini_cli.lines.changed` (Counter, Int): Number of lines changed (from file
708
+ diffs).
709
+ - **Attributes**:
710
+ - `function_name`
711
+ - `type` ("added" or "removed")
712
+
713
+ ##### Chat and streaming
714
+
715
+ Resilience counters for compression, invalid chunks, and retries.
716
+
717
+ - `gemini_cli.chat_compression` (Counter, Int): Counts chat compression
718
+ operations.
719
+ - **Attributes**:
720
+ - `tokens_before` (Int)
721
+ - `tokens_after` (Int)
722
+
723
+ - `gemini_cli.chat.invalid_chunk.count` (Counter, Int): Counts invalid chunks
724
+ from streams.
725
+
726
+ - `gemini_cli.chat.content_retry.count` (Counter, Int): Counts retries due to
727
+ content errors.
728
+
729
+ - `gemini_cli.chat.content_retry_failure.count` (Counter, Int): Counts requests
730
+ where all content retries failed.
731
+
732
+ ##### Model routing
733
+
734
+ Routing latency/failures and slash-command selections.
735
+
736
+ - `gemini_cli.slash_command.model.call_count` (Counter, Int): Counts model
737
+ selections via slash command.
738
+ - **Attributes**:
739
+ - `slash_command.model.model_name` (string)
740
+
741
+ - `gemini_cli.model_routing.latency` (Histogram, ms): Model routing decision
742
+ latency.
743
+ - **Attributes**:
744
+ - `routing.decision_model` (string)
745
+ - `routing.decision_source` (string)
746
+ - `routing.approval_mode` (string)
747
+
748
+ - `gemini_cli.model_routing.failure.count` (Counter, Int): Counts model routing
749
+ failures.
750
+ - **Attributes**:
751
+ - `routing.decision_source` (string)
752
+ - `routing.error_message` (string)
753
+ - `routing.approval_mode` (string)
754
+
755
+ ##### Agent runs
756
+
757
+ Agent lifecycle metrics: runs, durations, and turns.
758
+
759
+ - `gemini_cli.agent.run.count` (Counter, Int): Counts agent runs.
760
+ - **Attributes**:
761
+ - `agent_name` (string)
762
+ - `terminate_reason` (string)
763
+
764
+ - `gemini_cli.agent.duration` (Histogram, ms): Agent run durations.
765
+ - **Attributes**:
766
+ - `agent_name` (string)
767
+
768
+ - `gemini_cli.agent.turns` (Histogram, turns): Turns taken per agent run.
769
+ - **Attributes**:
770
+ - `agent_name` (string)
771
+
772
+ ##### Approval Mode
773
+
774
+ ###### Execution
775
+
776
+ These metrics track the adoption and usage of specific approval workflows, such
777
+ as Plan Mode.
778
+
779
+ - `gemini_cli.plan.execution.count` (Counter, Int): Counts plan executions.
780
+ - **Attributes**:
781
+ - `approval_mode` (string)
782
+
783
+ ##### UI
784
+
785
+ UI stability signals such as flicker count.
786
+
787
+ - `gemini_cli.ui.flicker.count` (Counter, Int): Counts UI frames that flicker
788
+ (render taller than terminal).
789
+
790
+ ##### Performance
791
+
792
+ Optional performance monitoring for startup, CPU/memory, and phase timing.
793
+
794
+ - `gemini_cli.startup.duration` (Histogram, ms): CLI startup time by phase.
795
+ - **Attributes**:
796
+ - `phase` (string)
797
+ - `details` (map, optional)
798
+
799
+ - `gemini_cli.memory.usage` (Histogram, bytes): Memory usage.
800
+ - **Attributes**:
801
+ - `memory_type` ("heap_used", "heap_total", "external", "rss")
802
+ - `component` (string, optional)
803
+
804
+ - `gemini_cli.cpu.usage` (Histogram, percent): CPU usage percentage.
805
+ - **Attributes**:
806
+ - `component` (string, optional)
807
+
808
+ - `gemini_cli.tool.queue.depth` (Histogram, count): Number of tools in the
809
+ execution queue.
810
+
811
+ - `gemini_cli.tool.execution.breakdown` (Histogram, ms): Tool time by phase.
812
+ - **Attributes**:
813
+ - `function_name` (string)
814
+ - `phase` ("validation", "preparation", "execution", "result_processing")
815
+
816
+ - `gemini_cli.api.request.breakdown` (Histogram, ms): API request time by phase.
817
+ - **Attributes**:
818
+ - `model` (string)
819
+ - `phase` ("request_preparation", "network_latency", "response_processing",
820
+ "token_processing")
821
+
822
+ - `gemini_cli.token.efficiency` (Histogram, ratio): Token efficiency metrics.
823
+ - **Attributes**:
824
+ - `model` (string)
825
+ - `metric` (string)
826
+ - `context` (string, optional)
827
+
828
+ - `gemini_cli.performance.score` (Histogram, score): Composite performance
829
+ score.
830
+ - **Attributes**:
831
+ - `category` (string)
832
+ - `baseline` (number, optional)
833
+
834
+ - `gemini_cli.performance.regression` (Counter, Int): Regression detection
835
+ events.
836
+ - **Attributes**:
837
+ - `metric` (string)
838
+ - `severity` ("low", "medium", "high")
839
+ - `current_value` (number)
840
+ - `baseline_value` (number)
841
+
842
+ - `gemini_cli.performance.regression.percentage_change` (Histogram, percent):
843
+ Percent change from baseline when regression detected.
844
+ - **Attributes**:
845
+ - `metric` (string)
846
+ - `severity` ("low", "medium", "high")
847
+ - `current_value` (number)
848
+ - `baseline_value` (number)
849
+
850
+ - `gemini_cli.performance.baseline.comparison` (Histogram, percent): Comparison
851
+ to baseline.
852
+ - **Attributes**:
853
+ - `metric` (string)
854
+ - `category` (string)
855
+ - `current_value` (number)
856
+ - `baseline_value` (number)
857
+
858
+ ### Traces
859
+
860
+ Traces offer a granular, "under-the-hood" view of every agent and backend
861
+ operation. By providing a high-fidelity execution map, they enable precise
862
+ debugging of complex tool interactions and deep performance optimization. Each
863
+ trace captures rich, consistent metadata via custom span attributes:
864
+
865
+ - `gen_ai.operation.name` (string): The high-level operation kind (e.g.
866
+ "tool_call", "llm_call").
867
+ - `gen_ai.agent.name` (string): The service agent identifier ("gemini-cli").
868
+ - `gen_ai.agent.description` (string): The service agent description.
869
+ - `gen_ai.input.messages` (string): Input messages or metadata specific to the
870
+ operation.
871
+ - `gen_ai.output.messages` (string): Output messages or metadata generated from
872
+ the operation.
873
+ - `gen_ai.request.model` (string): The request model name.
874
+ - `gen_ai.response.model` (string): The response model name.
875
+ - `gen_ai.system_instructions` (json string): The system instructions.
876
+ - `gen_ai.prompt.name` (string): The prompt name.
877
+ - `gen_ai.tool.name` (string): The executed tool's name.
878
+ - `gen_ai.tool.call_id` (string): The generated specific ID of the tool call.
879
+ - `gen_ai.tool.description` (string): The executed tool's description.
880
+ - `gen_ai.tool.definitions` (json string): The executed tool's description.
881
+ - `gen_ai.conversation.id` (string): The current CLI session ID.
882
+ - Additional user-defined Custom Attributes passed via the span's configuration.
883
+
884
+ #### GenAI semantic convention
885
+
886
+ The following metrics comply with [OpenTelemetry GenAI semantic conventions] for
887
+ standardized observability across GenAI applications:
888
+
889
+ - `gen_ai.client.token.usage` (Histogram, token): Number of input and output
890
+ tokens used per operation.
891
+ - **Attributes**:
892
+ - `gen_ai.operation.name` (string): The operation type (e.g.,
893
+ "generate_content", "chat")
894
+ - `gen_ai.provider.name` (string): The GenAI provider ("gcp.gen_ai" or
895
+ "gcp.vertex_ai")
896
+ - `gen_ai.token.type` (string): The token type ("input" or "output")
897
+ - `gen_ai.request.model` (string, optional): The model name used for the
898
+ request
899
+ - `gen_ai.response.model` (string, optional): The model name that generated
900
+ the response
901
+ - `server.address` (string, optional): GenAI server address
902
+ - `server.port` (int, optional): GenAI server port
903
+
904
+ - `gen_ai.client.operation.duration` (Histogram, s): GenAI operation duration in
905
+ seconds.
906
+ - **Attributes**:
907
+ - `gen_ai.operation.name` (string): The operation type (e.g.,
908
+ "generate_content", "chat")
909
+ - `gen_ai.provider.name` (string): The GenAI provider ("gcp.gen_ai" or
910
+ "gcp.vertex_ai")
911
+ - `gen_ai.request.model` (string, optional): The model name used for the
912
+ request
913
+ - `gen_ai.response.model` (string, optional): The model name that generated
914
+ the response
915
+ - `server.address` (string, optional): GenAI server address
916
+ - `server.port` (int, optional): GenAI server port
917
+ - `error.type` (string, optional): Error type if the operation failed
918
+
919
+ [OpenTelemetry GenAI semantic conventions]:
920
+ https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-metrics.md
921
+ [OpenTelemetry GenAI semantic conventions for events]:
922
+ https://github.com/open-telemetry/semantic-conventions/blob/8b4f210f43136e57c1f6f47292eb6d38e3bf30bb/docs/gen-ai/gen-ai-events.md