Pi OpenTelemetry
Extension
Opt-in, metadata-only logs, metrics, and traces for Pi activity, exported to a local OTLP/gRPC collector.
By Vedang Manerikar · git:github.com/vedang/pi-opentelemetry · View source
What it does
Pi OpenTelemetry records operational metadata about sessions, activities, runs, turns, model requests, and tool calls. It exports logs and metrics to an existing local OTLP/gRPC endpoint, with traces behind a second explicit opt-in.
It records timings, normalized outcomes, and live assistant token usage and estimated cost—not prompts, thinking, tool arguments or results, raw errors, credentials, or repository paths. The extension does not install a collector or viewer and does not enable telemetry merely by being installed.
When to reach for it
Invocation: Start a new Pi session with PI_OTEL_ENABLED=1; add PI_OTEL_TRACES=1 for traces. Use /otel-status inside Pi to inspect export health.
- Understanding latency and tool activity
- Inspect local logs and optional traces to see model-request and tool timing without capturing conversation content.
- Inspecting observed token usage and cost
- View live assistant usage metrics while treating missing cost as unknown and estimates as distinct from billing.
What it adds
- Metadata-only logs and delta metrics, plus optional activity → run → turn → request/tool traces.
- /otel-status reports disabled, unverified, healthy, or degraded export state.
- Explicit opt-in with a loopback-only OTLP/gRPC destination, defaulting to http://127.0.0.1:4317.
Commands: /otel-status
How it fits
- Pi Boomerang — Boomerang manages conversation context; OpenTelemetry observes live execution metadata independently of the retained transcript.
- Pi Interactive Shell — Telemetry does not automatically instrument child processes; separately launched Pi sessions need their own configuration.
Good to know
- Delivery is bounded, in-memory, and best effort: short sessions, outages, or queue overflow can lose records. Export acknowledgements do not prove durable storage in the viewer.
- Usage covers observed live assistant messages, not complete spending across compaction, summaries, nested models, or restored history.
- Use a trusted local collector. Inherited OTLP header settings disable this extension, and /otel-status is read-only rather than a reconfiguration command.
Source and setup
- Loaded via
git:github.com/vedang/pi-opentelemetry- Attribution
- By Vedang Manerikar