Quickstart: OpenTelemetry Observability¶
Feature: 018-otel-observability Date: 2026-01-04
Overview¶
This guide shows how to enable observability for your HoloDeck agents in 3 steps.
Prerequisites¶
- HoloDeck installed (
pip install holodeck-ai) - An observability backend (optional for getting started):
- OTLP: Jaeger, Aspire Dashboard, or any OTLP collector
- Prometheus: Prometheus server with Grafana
- Azure Monitor: Application Insights resource
Step 1: Add Observability Configuration¶
Add the observability section to your agent.yaml:
name: my-agent
description: My AI agent with observability
model:
provider: openai
name: gpt-4o-mini
instructions:
inline: You are a helpful assistant.
# Enable observability - service name defaults to "holodeck-my-agent"
observability:
enabled: true
exporters:
otlp:
enabled: true
endpoint: http://localhost:4317
That's it! Your agent now exports telemetry to the OTLP endpoint with service name "holodeck-my-agent" (derived from your agent's name field).
Step 2: Start an OTLP Collector (Optional)¶
For local development, use the Aspire Dashboard:
# Start Aspire Dashboard with Docker
docker run --rm -it \
-p 18888:18888 \
-p 4317:4317 \
mcr.microsoft.com/dotnet/aspire-dashboard:latest
Access the dashboard at http://localhost:18888.
Step 3: Run Your Agent¶
# Interactive chat
holodeck chat agent.yaml
# Run tests
holodeck test agent.yaml
# Start REST API server
holodeck serve agent.yaml
View traces, metrics, and logs in your observability backend.
Configuration Examples¶
Basic OTLP (Recommended for Development)¶
name: my-agent # Service name defaults to "holodeck-my-agent"
observability:
enabled: true
exporters:
otlp:
enabled: true
endpoint: http://localhost:4317
With Custom Service Name Override¶
name: my-agent
observability:
enabled: true
service_name: prod-my-agent # Overrides default "holodeck-my-agent"
exporters:
otlp:
enabled: true
endpoint: http://localhost:4317
Prometheus Metrics¶
name: my-agent # Service name: "holodeck-my-agent"
observability:
enabled: true
exporters:
prometheus:
enabled: true
port: 8889
Scrape metrics at http://localhost:8889/metrics.
Azure Monitor¶
name: my-agent # Service name: "holodeck-my-agent"
observability:
enabled: true
exporters:
azure_monitor:
enabled: true
connection_string: ${APPLICATIONINSIGHTS_CONNECTION_STRING}
Set the environment variable:
export APPLICATIONINSIGHTS_CONNECTION_STRING="InstrumentationKey=..."
Multiple Exporters¶
name: my-agent # Service name: "holodeck-my-agent"
observability:
enabled: true
exporters:
otlp:
enabled: true
endpoint: http://localhost:4317
prometheus:
enabled: true
port: 8889
azure_monitor:
enabled: true
connection_string: ${APPLICATIONINSIGHTS_CONNECTION_STRING}
With Sensitive Data Capture¶
name: my-agent # Service name: "holodeck-my-agent"
observability:
enabled: true
traces:
capture_content: true # Capture prompts/completions
redaction_patterns:
- '\b\d{3}-\d{2}-\d{4}\b' # Redact SSNs
- '\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b' # Redact emails
exporters:
otlp:
enabled: true
endpoint: http://localhost:4317
With Custom Headers (Authentication)¶
name: my-agent # Service name: "holodeck-my-agent"
observability:
enabled: true
exporters:
otlp:
enabled: true
endpoint: https://otel-collector.example.com:4317
headers:
authorization: Bearer ${OTEL_API_KEY}
x-custom-header: my-value
What Gets Captured¶
Traces¶
Every LLM invocation creates spans with:
gen_ai.system: Provider (openai, anthropic, etc.)gen_ai.request.model: Model namegen_ai.usage.input_tokens: Prompt tokensgen_ai.usage.output_tokens: Completion tokensgen_ai.response.finish_reasons: Why generation stopped
Metrics¶
- Token usage counters
- Request duration histograms
- Error counts
Logs¶
Structured logs with trace context for correlation.
Viewing Telemetry¶
Aspire Dashboard¶
- Open
http://localhost:18888 - Click Traces to see request flows
- Click individual spans to see attributes
Jaeger¶
- Open Jaeger UI (default:
http://localhost:16686) - Select service:
holodeck-my-agent(or your customservice_name) - Click Find Traces
Prometheus + Grafana¶
- Add Prometheus data source in Grafana
- Query
holodeck_*metrics - Create dashboards for token usage, latency, errors
Azure Monitor¶
- Open Application Insights in Azure Portal
- Click Transaction search
- Filter by operation name
Troubleshooting¶
No telemetry appearing?¶
- Verify
observability.enabled: true - Check exporter endpoint is reachable
- Ensure at least one exporter is enabled
Connection refused errors?¶
- Verify collector is running
- Check port matches configuration
- For Docker, ensure ports are exposed
Missing spans?¶
- Check
sample_rateis > 0 (default: 1.0) - Verify
traces.enabled: true