Skip to main content
Goose includes comprehensive observability through OpenTelemetry (OTel), providing traces, metrics, and logs for production monitoring and debugging.

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

Telemetry data is automatically sent to your OTLP collector.

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:
Trace structure:
Trace attributes:
  • session.id: Session identifier
  • provider.name: AI provider (anthropic, openai, etc.)
  • model.name: Model used
  • tool.name: Tool invoked
  • extension.name: MCP extension

Metrics

Metrics track performance and usage:
Built-in metrics:
  • 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:
Log levels:
  • trace: Very detailed debugging
  • debug: Debugging information
  • info: General informational messages
  • warn: Warning messages
  • error: Error messages
Log attributes:
  • trace_id: Correlate with traces
  • span_id: Specific span within trace
  • session_id: Session identifier
  • module: Rust module path

Integration Examples

Jaeger (Tracing)

Prometheus + Grafana (Metrics)

otel-config.yaml:

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-cli and goose-server main functions

Initialization

From crates/goose/src/otel/otlp.rs:

Resource Attributes

Goose automatically includes:
Additional attributes from 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
Customize with RUST_LOG:

Metrics Filtering

Metrics are captured for:
  • INFO level and above
  • Events marked with metric fields

Log Filtering

Log level determined by:
  1. RUST_LOG (highest priority)
  2. OTEL_LOG_LEVEL
  3. 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
For production, use OTLP with batching (default) for minimal overhead.

Troubleshooting

No telemetry data

Spans not correlating

Ensure trace context propagation:

High memory usage

Reduce batch size:

Resources