gemini-cli is the easiest of the six runtimes to integrate. It is Tier A: it ships first-class OpenTelemetry support via .gemini/settings.json plus GEMINI_TELEMETRY_* env vars, emitting both gen_ai.* attributes and a rich gemini_cli.* namespace. Mara's preset configures Gemini to point at Mara's local OTLP receiver and normalizes the events.
gemini-cliinstalled (gemini --version).- Mara installed.
- A sink endpoint.
mara setup geminiThis generates a Mara config with the OTLP receiver listening on 127.0.0.1:4317. It also writes a default .gemini/settings.json snippet you can merge into your config.
(Same patterns as other quickstarts.)
brew services start maraEdit your Gemini settings file (~/.gemini/settings.json or per-project .gemini/settings.json):
{
"telemetry": {
"enabled": true,
"target": "otlp",
"otlpEndpoint": "http://127.0.0.1:4317",
"otlpProtocol": "grpc",
"logPrompts": false
}
}Or via env vars:
export GEMINI_TELEMETRY_ENABLED=true
export GEMINI_TELEMETRY_OTLP_ENDPOINT=http://127.0.0.1:4317
export GEMINI_TELEMETRY_TRACES_ENABLED=true
# export GEMINI_TELEMETRY_LOG_PROMPTS=true # opt-in onlygemini "explain this Cargo.toml" -p Cargo.tomlEvents arrive at Mara's OTLP receiver, normalize, and ship to your sink.
- Session lifecycle (
session.start,session.end). - Per-turn prompts and completions (subject to
logPrompts). - Tool calls and results —
gemini-cliexposes these ingen_ai.tool.*attributes. - Token usage —
gen_ai.usage.input_tokens,gen_ai.usage.output_tokens. - Cost — when
gemini-cliincludes it or Mara computes from a price table. - Per-turn latency.
- Errors.
The full set of gemini_cli.* attributes (per Gemini docs) is preserved under the attributes.* bag and surfaced via the OTLP receiver.
If you prefer file output instead of OTLP:
{
"telemetry": {
"enabled": true,
"target": "file",
"outfile": "${HOME}/.gemini/telemetry.log"
}
}Then point Mara at the file:
[[adapters.jsonl]]
name = "gemini_outfile"
globs = ["${HOME}/.gemini/telemetry.log*"]
checkpoint_path = "${XDG_STATE_HOME}/mara/checkpoints/gemini"OTLP is simpler and lower-latency; the file path is useful for offline or air-gapped setups.
logPrompts: falsekeeps prompt content out of telemetry. Default for Mara's preset.- To capture prompts: set
logPrompts: truein Gemini config andcapture_optin = truein Mara policy. - Mara honors
OTEL_LOG_USER_PROMPTSif Gemini reads it (verify against your Gemini version).
mara diag
curl -s http://127.0.0.1:9099/metrics | grep geminiRun a Gemini command and watch Mara's metrics tick up:
gemini "what's 2 + 2?"
sleep 2
curl -s http://127.0.0.1:9099/metrics | grep mara_pipeline_events_total- Telemetry disabled by default — Gemini ships with telemetry off; the most common reason no events appear is that the user didn't enable it.
- Different settings file precedence — project
.gemini/settings.jsonoverrides home; check which one applies. logPromptswith prompts containing secrets — pair with Mara's PII pack which redacts API keys and tokens before sink dispatch.- OTLP gRPC vs HTTP —
otlpProtocol: "http"works against127.0.0.1:4318instead of4317.
Gemini API consumers (apps that call Gemini's HTTP API directly) typically use the OTel SDK for their language. Mara receives that OTLP the same way it receives Gemini CLI's OTLP — the preset's OTLP receiver doesn't care which client emitted the event.
- Gemini CLI telemetry: https://geminicli.com/docs/cli/telemetry/.
- Gemini CLI telemetry (GitHub): https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/telemetry.md.
- Mara Gemini runtime preset:
crates/mara-runtimes/gemini/. - AI runtime telemetry surfaces (Gemini section):
../01-landscape/08-ai-runtime-telemetry-surfaces.md.