Exported spans and diagnostic events
The exported span catalog with its attributes, and the diagnostic event catalog behind the metrics and spans
Exported spans
-
openclaw.gateway.rpc.response,openclaw.gateway.rpc.handler,openclaw.gateway.rpc.dispatch- Completed phase observations with
openclaw.gateway.rpc.method,openclaw.gateway.rpc.phase, andopenclaw.gateway.rpc.outcome - Handler spans include
openclaw.gateway.rpc.admission_ms; dispatch spans includeopenclaw.gateway.rpc.response, the response state at dispatch settlement - Preserve a supplied upstream request parent; they do not introduce a long-lived RPC parent span or change downstream trace propagation
- Completed phase observations with
-
openclaw.model.usageopenclaw.channel,openclaw.provider,openclaw.model, optionalopenclaw.agent(the agent that owns the run when known)- Optional host-derived
openclaw.pluginonly for trusted plugin runtime completions openclaw.tokens.*(input/output/cache_read/cache_write/total)gen_ai.systemby default, orgen_ai.provider.namewhen the latest GenAI semantic conventions are opted ingen_ai.request.model,gen_ai.operation.name,gen_ai.usage.*
Plugin attribution is span-only. It does not add a plugin dimension to shared OpenTelemetry metrics or change Prometheus metric labels.
openclaw.runopenclaw.outcome,openclaw.channel,openclaw.provider,openclaw.model,openclaw.errorCategory, optionalopenclaw.agent
openclaw.model.callgen_ai.systemby default, orgen_ai.provider.namewhen the latest GenAI semantic conventions are opted ingen_ai.request.model,gen_ai.operation.name,openclaw.provider,openclaw.model,openclaw.api,openclaw.transport,openclaw.model_call.observation_unit(requestorturn), optionalopenclaw.agentopenclaw.errorCategory,error.type, and optionalopenclaw.failureKindon errorsopenclaw.model_call.request_bytes,openclaw.model_call.response_bytes,openclaw.model_call.time_to_first_byte_msopenclaw.model_call.prompt.input_messages_count,openclaw.model_call.prompt.input_messages_chars,openclaw.model_call.prompt.system_prompt_chars,openclaw.model_call.prompt.tool_definitions_count,openclaw.model_call.prompt.tool_definitions_chars,openclaw.model_call.prompt.total_chars(safe component sizes only, no prompt text)openclaw.model_call.usage.*andgen_ai.usage.*when the result carries usage for that request or aggregate turn- Span event
openclaw.provider.requestwith attributeopenclaw.upstreamRequestIdHash(bounded, hash-based) when the upstream provider result exposes a request id; raw ids are never exported - With
OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental, request spans use the latest GenAI inference span name{gen_ai.operation.name} {gen_ai.request.model}. Turn spans useinvoke_agentbecause OpenClaw does not claim a native agent name from the opaque CLI boundary. Both useCLIENTspan kind instead ofopenclaw.model.call.
openclaw.harness.runopenclaw.harness.id,openclaw.harness.plugin,openclaw.outcome,openclaw.provider,openclaw.model,openclaw.channel, optionalopenclaw.agent- On completion:
openclaw.harness.result_classification,openclaw.harness.yield_detected,openclaw.harness.items.started,openclaw.harness.items.completed,openclaw.harness.items.active - On error:
openclaw.harness.phase,openclaw.errorCategory, optionalopenclaw.harness.cleanup_failed - Span event
openclaw.agent.commentaryfor completed preambles from supported harnesses, including the built-in runtime, Codex, and Claude CLI. Attributes includeopenclaw.commentary.sequence,openclaw.commentary.text_length, andopenclaw.commentary.content_truncated. The existingdiagnostics.otel.captureContentsetting controls bounded, redacted output-message content.
openclaw.tool.executiongen_ai.tool.name,gen_ai.operation.name(execute_tool),openclaw.toolName,openclaw.tool.source, optionalgen_ai.tool.call.id,openclaw.tool.owner,openclaw.tool.params.*, optionalopenclaw.agent- Optional
openclaw.errorCategory/openclaw.errorCodeon errors,openclaw.deniedReasonandopenclaw.outcome=blockedwhen denied by policy or sandbox
openclaw.execopenclaw.exec.target,openclaw.exec.mode,openclaw.outcome,openclaw.failureKind,openclaw.exec.command_length,openclaw.exec.exit_code,openclaw.exec.exit_signal,openclaw.exec.timed_out
openclaw.webhook.processedopenclaw.channel,openclaw.webhook
openclaw.webhook.erroropenclaw.channel,openclaw.webhook,openclaw.error
openclaw.message.processedopenclaw.channel,openclaw.outcome,openclaw.reason, optionalopenclaw.agent(the agent that initially ingested the prompt)- Isolated cron agent turns use this span as the parent of their harness spans, keeping model calls, tools, and usage on the same trace through completion or failure.
openclaw.message.deliveryopenclaw.channel,openclaw.delivery.kind,openclaw.outcome,openclaw.errorCategory,openclaw.delivery.result_count
openclaw.session.stuckopenclaw.state,openclaw.ageMs,openclaw.queueDepth
openclaw.context.assembledopenclaw.prompt.size,openclaw.history.size,openclaw.context.tokens,openclaw.errorCategory(no prompt, history, response, or session-key content)
openclaw.tool.loopopenclaw.toolName,openclaw.loop.level,openclaw.loop.action,openclaw.loop.detector,openclaw.loop.count, optionalopenclaw.loop.paired_tool, optionalopenclaw.agent(no loop messages, params, or tool output)
openclaw.memory.pressureopenclaw.memory.level,openclaw.memory.reason,openclaw.memory.rss_bytes,openclaw.memory.heap_used_bytes,openclaw.memory.heap_total_bytes,openclaw.memory.external_bytes,openclaw.memory.array_buffers_bytes, optionalopenclaw.memory.threshold_bytes/openclaw.memory.rss_growth_bytes/openclaw.memory.window_ms
When content capture is explicitly enabled, model and tool spans can also
include bounded, redacted openclaw.content.* attributes for the specific
content classes you opted into.
Diagnostic event catalog
The events below back the
metrics and
spans above. Public events are also
available for direct plugin subscription; trusted core events such as
model.usage are restricted to authorized internal consumers.
run.progress and run.execution_phase are direct-only lifecycle signals;
the diagnostics-otel plugin does not export them as standalone OTLP signals.
Event kinds and run.execution_phase.phase values are additive. TypeScript
consumers should keep default branches instead of assuming either union is
permanently exhaustive.
agent.commentary records completed preambles, not text deltas. It carries the
original agent-event sequence and timestamp and attaches to the active harness
span. Recent duplicate completions are suppressed per attempt. Like other
queued diagnostics, commentary may be dropped under queue pressure; the session
transcript remains the durable conversation record. At debug level, the
diagnostic logger also records completion metadata without commentary text.
Model usage
model.usage is a trusted, in-process diagnostic event, not a JSONL log
record. A representative event has this shape:
{
"type": "model.usage",
"ts": 1735689600000,
"seq": 42,
"provider": "openai",
"model": "gpt-5.4",
"channel": "webchat",
"agentId": "main",
"sessionId": "session-123",
"sessionKey": "agent:main:main",
"usage": {
"input": 120,
"output": 40,
"cacheRead": 30,
"cacheWrite": 10,
"promptTokens": 160,
"total": 200
},
"lastCallUsage": {
"input": 120,
"output": 40,
"cacheRead": 30,
"cacheWrite": 10,
"total": 200
},
"context": { "limit": 128000, "used": 160 },
"costUsd": 0.0012,
"durationMs": 850,
"trace": {
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
"spanId": "00f067aa0ba902b7",
"traceFlags": "01"
}
}tsis a Unix timestamp in milliseconds;seqis process-local.usageholds turn-level token counts.promptTokensincludesinput,cacheRead, andcacheWrite;lastCallUsage, when available, describes the final model call.context.usedis the current prompt/context snapshot and can be lower thanusage.totalwhen cached input or tool-loop calls are involved.- Provider/model/session identifiers, token buckets,
lastCallUsage,context,costUsd,durationMs, andtracefields are optional.costUsdis an estimate and can be absent when model pricing is unavailable; it is not provider-reported billing. Trace context can also includeparentSpanId.
The Gateway's /tmp/openclaw/openclaw-YYYY-MM-DD.log JSONL file and
diagnostics.otel.logsExporter: "stdout" contain ordinary log records, not raw
model.usage events. Public diagnostic subscriptions and
diagnostics.stability do not expose trusted core usage events. The
diagnostics-otel plugin converts them to metrics such as openclaw.tokens and
openclaw.cost.usd and to openclaw.model.usage spans; those usage metrics
and spans intentionally omit session identifiers.
For an external integration that needs session-correlated usage, query the authenticated Gateway instead:
openclaw gateway call sessions.usage --params '{"range":"30d","agentScope":"all"}' --json
openclaw gateway usage-cost --days 30 --all-agents --jsonBoth commands require operator.read. sessions.usage can include per-session
sessionId, provider/model details, and token/cost summaries; per-session usage
can be temporarily null while its cache refreshes. usage-cost provides
aggregate estimates. Omit agentScope or --all-agents to scope the report
to the default agent. For continuously updated clients,
subscribe to session changes instead of polling usage reports.
See the Gateway RPC method reference
for usage methods and request options.
Message flow
webhook.received/webhook.processed/webhook.errormessage.queued/message.processedmessage.delivery.started/message.delivery.completed/message.delivery.error
Gateway RPC
gateway.rpc- trusted request observations with phasesreceived,response,handler, anddispatch. Response outcomes areok,error,unavailable, orsuppressed; handler outcomes arereturnedorthrew; dispatch outcomes arereturned,threw,rejected, orcancelled. Dispatch records its response state (none,sent,unavailable, orsuppressed) at settlement; a later response can still arrive. Durations and queue/admission semantics are described in Gateway RPC metrics.
Queue and session
queue.lane.enqueue/queue.lane.dequeuesession.state/session.long_running/session.stalled/session.stuckrun.attempt/run.progressrun.execution_phase(public, session-correlated embedded-runner startup milestones)diagnostic.heartbeat(aggregate counters: webhooks/queue/session)gateway.event_loop.sample(internal metrics-only completed window:intervalMs,delayMaxMs; no reader identity)
Harness lifecycle
harness.run.started/harness.run.completed/harness.run.error- per-run lifecycle for the agent harness. IncludesharnessId, optionalpluginId, provider/model/channel, and run id. Completion addsdurationMs,outcome, optionalresultClassification,yieldDetected, anditemLifecyclecounts. Errors addphase(prepare/start/send/resolve/cleanup),errorCategory, and optionalcleanupFailed.
Exec
exec.process.completed- terminal outcome, duration, target, mode, exit code, and failure kind. Command text and working directories are not included.exec.approval.followup_suppressed- stale approval follow-up dropped after a session rebound. IncludesapprovalId,reason(session_rebound),phase(direct_deliveryorgateway_preflight), and the dispatcher timestamp. Session keys, routes, and command text are not included.