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:
From this plugin (openclaw-observability):
- openclaw.llm.tokens.total / openclaw.llm.tokens.prompt / openclaw.llm.tokens.completion — Token usage by gen_ai.response.model
- openclaw.llm.cost.usd — Estimated model cost by gen_ai.response.model
- openclaw.tool.calls — Tool call counter
- openclaw.session.resets — Session reset counter
From the built-in diagnostics-otel plugin (only if you also enabled it in openclaw.json):
- openclaw.tokens — Token usage (emitted by diagnostics-otel, not by this plugin)
- openclaw.cost.usd — Cost tracking (emitted by diagnostics-otel, not by this plugin)
- openclaw.run.duration_ms — Agent run times
- openclaw.message.* — Message processing
- openclaw.queue.* — Queue metrics
Create Dashboard¶
Create a dashboard with (queries below assume this plugin's metrics):
-- Token usage by model
timeseries sum(openclaw.llm.tokens.total), by:{gen_ai.response.model}
-- Cost over time
timeseries sum(openclaw.llm.cost.usd), by:{gen_ai.response.model}
-- Agent turn duration (span attribute, query via spans)
fetch spans
| filter span.name == "openclaw.agent.turn"
| summarize avg_duration = avg(openclaw.agent.duration_ms),
by:{gen_ai.response.model}
View Logs¶
- Go to Logs
- Filter:
dt.entity.service = "openclaw-gateway" - View log records with severity and attributes
Example DQL Queries¶
The queries below target spans/metrics emitted by this plugin. If you only have the built-in
diagnostics-otelplugin enabled, you'll need to swapopenclaw.llm.*foropenclaw.tokens/openclaw.cost.usdand adjust the group-by attribute toopenclaw.model.
Token Usage by Model¶
timeseries tokens = sum(openclaw.llm.tokens.total),
by:{gen_ai.response.model}
| sort arrayLast(tokens) desc
Average Agent Turn Duration¶
fetch spans
| filter dt.entity.service == "openclaw-gateway"
| filter span.name == "openclaw.agent.turn"
| summarize avg_duration = avg(openclaw.agent.duration_ms),
by:{gen_ai.response.model}
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