About
Ship Gemini CLI session telemetry to Sazabi using Gemini CLI’s built-in OpenTelemetry exporter. Once configured, every session emits structured events covering startup configuration, user prompts, tool calls, and model API requests with token counts and latency, plus spans for model calls and tool calls — no code changes to your projects required. Events include names likegemini_cli.config, gemini_cli.user_prompt, gemini_cli.tool_call, and gemini_cli.api_request, along with prompt, model, session.id, installation.id, user.email, and token counts per API call.
Prerequisites
- Gemini CLI installed, with a login that can call models: Gemini Code Assist Standard or Enterprise, Code Assist for GitHub, a paid Gemini API key, or Vertex AI. Free individual access and Google AI Pro and Ultra moved to Antigravity CLI on June 18, 2026.
- Your Sazabi intake URL, shown above — open the log source and copy the Intake URL from its setup screen (the public key is embedded in the URL)
Set up in the dashboard
1
Add a telemetry block to Gemini CLI settings
Open or create~/.gemini/settings.json and add the following telemetry block. If the file already has a telemetry object, set these keys inside it instead of adding a second one:~/.gemini/settings.json
<your intake URL> with the intake URL shown above.Keep otlpProtocol at http — Gemini CLI defaults to gRPC, and your intake URL takes OTLP over HTTP. Gemini CLI adds the /v1/logs and /v1/traces paths itself, so paste the URL as shown. Leave traces unset: it adds full prompts and tool outputs to spans.2
Restart Gemini CLI
Gemini CLI loads settings at startup. Quit and relaunch Gemini CLI for the new telemetry settings to take effect.Set up with the CLI
You can also register the Gemini CLI log source with the Sazabi CLI (installed and authenticated — see CLI reference). Registering the source mints the same intake URL the dashboard shows above (the public key is embedded in its hostname):sazabi log-sources get <log-source-id> at any time to reprint the endpoint, or sazabi log-sources list to see every log source in the project.
Verify
Start a Gemini CLI session and run a prompt. Open the Intake page in the Sazabi dashboard and confirm events from the Gemini CLI source appear within a minute or two. Start a thread and search forgemini_cli.api_request to find model API requests with token counts, or search for session.id to view all events from a single session.
Troubleshooting
No events after restarting — Confirm~/.gemini/settings.json is valid JSON, telemetry.enabled is true, and otlpProtocol is http. Environment variables such as GEMINI_TELEMETRY_OTLP_ENDPOINT, GEMINI_TELEMETRY_TARGET, or OTEL_EXPORTER_OTLP_ENDPOINT override the settings file, and a .gemini/settings.json inside a project overrides it for that project. An outfile key in the telemetry block writes telemetry to a file instead of sending it; remove it.
Only a gemini_cli.config event arrives — Gemini CLI started but could not call a model. Check that your login still has access; see Prerequisites.
Headless runs send nothing — gemini -p in a folder Gemini CLI does not trust exits before the first prompt. Trust the folder, or pass --skip-trust.
Events appear but prompts are missing — Confirm logPrompts is true, then restart Gemini CLI. Prompt text is exported starting with the next session.
Unexpected metric records appear — Gemini CLI always sends metrics alongside logs and traces, and no setting turns them off. Sazabi stores each metric data point as a log record with telemetry.type set to metric, and those records count toward your intake volume.
Further reading
Gemini CLI telemetry
Gemini CLI’s reference for every telemetry setting and event.
Intake
See per-source ingestion volume and health.
Log sources
Browse the full log source catalog.