Overview
Goose’s telemetry system provides:- Distributed tracing: Track requests across agents, providers, and extensions
- Metrics: Monitor performance, token usage, and error rates
- Structured logs: Debug issues with contextual information
- Flexible exporters: OTLP, console, or custom backends
Quick Start
Enable OpenTelemetry
Local Testing with Console Exporter
Configuration
Environment Variables
Global Settings
Endpoint Configuration
Signal-Specific Settings
Configuration File
Set in~/.config/goose/config.yaml:
Configuration file settings are promoted to environment variables at startup. Environment variables take precedence.
Signal Configuration
Traces
Traces track request flows through Goose:session.id: Session identifierprovider.name: AI provider (anthropic, openai, etc.)model.name: Model usedtool.name: Tool invokedextension.name: MCP extension
Metrics
Metrics track performance and usage:goose.session.duration: Session length (histogram)goose.provider.tokens.input: Input tokens per request (counter)goose.provider.tokens.output: Output tokens per request (counter)goose.provider.latency: Provider response time (histogram)goose.tool.invocations: Tool call count (counter)goose.tool.duration: Tool execution time (histogram)goose.errors: Error count by type (counter)
Logs
Structured logs with trace correlation:trace: Very detailed debuggingdebug: Debugging informationinfo: General informational messageswarn: Warning messageserror: Error messages
trace_id: Correlate with tracesspan_id: Specific span within tracesession_id: Session identifiermodule: Rust module path
Integration Examples
Jaeger (Tracing)
Prometheus + Grafana (Metrics)
Elastic Stack (Full Observability)
Datadog
Implementation Details
Source Code
- OTel setup:
crates/goose/src/otel/otlp.rs - Module:
crates/goose/src/otel/mod.rs - Initialization: Called from
goose-cliandgoose-servermain functions
Initialization
Fromcrates/goose/src/otel/otlp.rs:
Resource Attributes
Goose automatically includes:OTEL_RESOURCE_ATTRIBUTES:
Signal Detection
Goose determines which signals to enable:Filtering
Trace Filtering
By default, Goose captures:- All spans at INFO level and above
- DEBUG level for Goose modules
RUST_LOG:
Metrics Filtering
Metrics are captured for:- INFO level and above
- Events marked with metric fields
Log Filtering
Log level determined by:RUST_LOG(highest priority)OTEL_LOG_LEVEL- Default:
info
Custom Telemetry
Add custom spans and metrics in your extensions:Disabling Telemetry
Complete Disable
Custom Distributions
For custom Goose distributions, disable in code:Performance Impact
OpenTelemetry overhead:- Console exporter: ~5-10% CPU
- OTLP exporter: ~2-5% CPU + network I/O
- Memory: ~10-50 MB for buffering
Troubleshooting
No telemetry data
Spans not correlating
Ensure trace context propagation:High memory usage
Reduce batch size:Resources
- OpenTelemetry Specification: https://opentelemetry.io/docs/specs/otel/
- Rust SDK: https://github.com/open-telemetry/opentelemetry-rust
- Goose implementation:
crates/goose/src/otel/ - Example integrations: https://opentelemetry.io/ecosystem/integrations/