Get OpenTelemetry observability for your OpenClaw AI agents.
- OpenClaw v2026.2.0 or later
- An OTLP endpoint (local collector, Dynatrace, Grafana, etc.)
The fastest way to get observability. No installation needed — just configure.
Add to your ~/.openclaw/openclaw.json:
{
"diagnostics": {
"enabled": true,
"otel": {
"enabled": true,
"endpoint": "http://localhost:4318",
"serviceName": "openclaw-gateway",
"traces": true,
"metrics": true,
"logs": true
}
}
}openclaw gateway restartSend a message to your agent and check your backend for:
- Metrics:
openclaw.tokens,openclaw.cost.usd,openclaw.run.duration_ms - Traces:
openclaw.model.usage,openclaw.message.processed - Logs: Gateway logs with severity and code location
For connected traces and per-tool-call visibility, add the custom plugin.
cd ~/.openclaw/extensions
git clone https://github.com/henrikrexed/openclaw-observability-plugin.git otel-observabilitycd otel-observability
npm installAdd to your ~/.openclaw/openclaw.json:
{
"plugins": {
"load": {
"paths": ["~/.openclaw/extensions/otel-observability"]
},
"entries": {
"otel-observability": {
"enabled": true
}
}
}
}Note: Do NOT add a
configblock insideotel-observability— OpenClaw's plugin framework rejects unknown properties. The plugin reads its settings from thediagnostics.otelsection instead. If you need custom settings, configure them indiagnostics.otel(see Option 1 above).
rm -rf /tmp/jiti
systemctl --user restart openclaw-gateway
# Or: openclaw gateway restartSend a message that triggers tool calls (e.g., "read my AGENTS.md file"). You should see:
openclaw.request
└── openclaw.agent.turn
└── tool.Read
For complete observability, enable both:
{
"diagnostics": {
"enabled": true,
"otel": {
"enabled": true,
"endpoint": "http://localhost:4318",
"serviceName": "openclaw-gateway",
"traces": true,
"metrics": true,
"logs": true
}
},
"plugins": {
"load": {
"paths": ["~/.openclaw/extensions/otel-observability"]
},
"entries": {
"otel-observability": {
"enabled": true,
"config": {
"endpoint": "http://localhost:4318",
"serviceName": "openclaw-gateway"
}
}
}
}
}What you get:
| Source | Data |
|---|---|
| Official | Gateway health, queue metrics, log forwarding, session states |
| Custom | Connected request traces, tool call spans, agent turn details |
-
Install:
# Ubuntu/Debian wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.144.0/otelcol-contrib_0.144.0_linux_amd64.deb sudo dpkg -i otelcol-contrib_0.144.0_linux_amd64.deb -
Configure (
/etc/otelcol-contrib/config.yaml):receivers: otlp: protocols: http: endpoint: 0.0.0.0:4318 processors: batch: exporters: debug: verbosity: detailed # Add your backend exporter service: pipelines: traces: receivers: [otlp] processors: [batch] exporters: [debug] metrics: receivers: [otlp] processors: [batch] exporters: [debug] logs: receivers: [otlp] processors: [batch] exporters: [debug]
-
Start:
sudo systemctl start otelcol-contrib
No collector needed:
{
"diagnostics": {
"enabled": true,
"otel": {
"enabled": true,
"endpoint": "https://{environment-id}.live.dynatrace.com/api/v2/otlp",
"headers": {
"Authorization": "Api-Token {your-token}"
},
"serviceName": "openclaw-gateway",
"traces": true,
"metrics": true,
"logs": true
}
}
}Required scopes: metrics.ingest, logs.ingest, openTelemetryTrace.ingest
{
"diagnostics": {
"enabled": true,
"otel": {
"enabled": true,
"endpoint": "https://otlp-gateway-{region}.grafana.net/otlp",
"headers": {
"Authorization": "Basic {base64(instanceId:apiKey)}"
},
"serviceName": "openclaw-gateway",
"traces": true,
"metrics": true
}
}
}-
Check Gateway logs:
journalctl --user -u openclaw-gateway -f
-
Verify endpoint is reachable:
curl -v http://localhost:4318/v1/traces
-
Check diagnostics config:
cat ~/.openclaw/openclaw.json | jq '.diagnostics'
-
Check plugin discovery:
openclaw plugins list
-
Clear jiti cache:
rm -rf /tmp/jiti
-
Check for TypeScript errors in Gateway logs
The custom plugin requires messages to flow through the normal pipeline. Heartbeats and some internal events may not have full trace context.
- Configuration Reference — All options
- Architecture — How it works
- Limitations — Known constraints
- Backend Guides — Specific backend setup