Dynatrace Setup¶
Send OpenClaw telemetry directly to Dynatrace using OTLP.
Prerequisites¶
- Dynatrace environment (SaaS or Managed)
- API token with ingest permissions
Create API Token¶
- Go to Settings → Access tokens
- Click Generate new token
- Add scopes:
metrics.ingestlogs.ingestopenTelemetryTrace.ingest- Copy the token (starts with
dt0c01.)
Configure OpenClaw¶
Add to ~/.openclaw/openclaw.json:
{
"diagnostics": {
"enabled": true,
"otel": {
"enabled": true,
"endpoint": "https://{environment-id}.live.dynatrace.com/api/v2/otlp",
"headers": {
"Authorization": "Api-Token dt0c01.XXXXXXXX"
},
"serviceName": "openclaw-gateway",
"traces": true,
"metrics": true,
"logs": true
}
}
}
Replace:
- {environment-id} — Your Dynatrace environment ID (e.g., abc12345)
- dt0c01.XXXXXXXX — Your API token
Dynatrace Managed¶
For Dynatrace Managed, use your ActiveGate URL:
{
"diagnostics": {
"enabled": true,
"otel": {
"enabled": true,
"endpoint": "https://{your-activegate}/e/{environment-id}/api/v2/otlp",
"headers": {
"Authorization": "Api-Token dt0c01.XXXXXXXX"
},
"serviceName": "openclaw-gateway"
}
}
}
Restart Gateway¶
Verify in Dynatrace¶
Find Your Service¶
- Go to Services in Dynatrace
- Search for
openclaw-gateway - Click to view service details
View Traces¶
- Go to Distributed traces
- Filter by service:
openclaw-gateway - Click a trace to see spans
View Metrics¶
- Go to Explore → Metrics
- Search for
openclaw. - Available metrics:
openclaw.tokens— Token usageopenclaw.cost.usd— Cost trackingopenclaw.run.duration_ms— Agent run timesopenclaw.message.*— Message processingopenclaw.queue.*— Queue metrics
Create Dashboard¶
Create a dashboard with:
-- Token usage by model
timeseries sum(openclaw.tokens), by:{openclaw.model, openclaw.token}
-- Cost over time
timeseries sum(openclaw.cost.usd), by:{openclaw.model}
-- Agent run duration
timeseries avg(openclaw.run.duration_ms), by:{openclaw.model}
View Logs¶
- Go to Logs
- Filter:
dt.entity.service = "openclaw-gateway" - View log records with severity and attributes
Example DQL Queries¶
Token Usage by Model¶
fetch spans
| filter dt.entity.service == "openclaw-gateway"
| summarize tokens = sum(openclaw.tokens.total), by:{openclaw.model}
| sort tokens desc
Average Run Duration¶
fetch spans
| filter dt.entity.service == "openclaw-gateway"
| filter matchesPhrase(span.name, "model")
| summarize avg_duration = avg(openclaw.run.duration_ms)
Error Rate¶
fetch logs
| filter dt.entity.service == "openclaw-gateway"
| filter loglevel == "ERROR"
| summarize count = count()
Troubleshooting¶
No Data in Dynatrace?¶
- Check token permissions: Ensure all three scopes are enabled
- Verify endpoint URL: Should be
https://{env-id}.live.dynatrace.com/api/v2/otlp - Test connectivity:
Service Not Appearing?¶
- Wait 2-5 minutes for service detection
- Send a few messages to generate telemetry
- Check Dynatrace logs for ingest errors
403 Forbidden?¶
Token lacks required scopes. Regenerate with all three:
- metrics.ingest
- logs.ingest
- openTelemetryTrace.ingest