Skip to main content

Signals exported

Toggle traces, metrics, and logs independently. Traces and metrics default to on when diagnostics.otel.enabled is true; logs default to off and export only when diagnostics.otel.logs is explicitly true. Log export defaults to OTLP; set diagnostics.otel.logsExporter to stdout for JSONL on stdout, or both for both.
The shared endpoint and OTEL_EXPORTER_OTLP_ENDPOINT are bases for all enabled signals. OpenClaw appends /v1/traces, /v1/metrics, or /v1/logs to root and custom collector paths. For compatibility with hosted frontends, a shared endpoint already ending in one of those signal paths keeps that path for its matching signal and replaces the terminal segment for the others.Signal-specific tracesEndpoint, metricsEndpoint, and logsEndpoint settings, plus their matching OTEL_EXPORTER_OTLP_*_ENDPOINT fallbacks, are passed to the exporter as exact URLs. OpenClaw does not append or rewrite their paths.

Configuration reference

metricNamePrefix replaces the default openclaw. prefix only on OpenClaw-owned metrics. For example, "acme." exports openclaw.tokens as acme.tokens; set it to "" to export tokens with no prefix. Non-empty values must start with an ASCII letter, use only letters, digits, underscores, dots, hyphens, and slashes, and contain at most 128 characters. Set it to "acme.openclaw." if you want acme.openclaw.tokens. Standard semantic-convention metrics such as gen_ai.client.token.usage and gen_ai.client.operation.duration keep their original names. Leave the option unset to preserve every current metric name. Enabling or changing this option renames the affected metric series, so update dashboards, alerts, and recording rules that query the old names.

Environment variables

Without OPENCLAW_OTEL_PRELOADED=1, trace, metric, and log providers are generation-private. The plugin publishes only its async context manager and propagator through the public OpenTelemetry APIs, and removes them only while those public behaviors still match the generation being stopped. A replacement host or later generation therefore keeps ownership through cleanup.

Sampling and flushing

  • Traces: diagnostics.otel.sampleRate sets a TraceIdRatioBasedSampler on the root span only (0.0 drops all, 1.0 keeps all). Unset uses the OpenTelemetry SDK default (always-on).
  • Metrics: diagnostics.otel.flushIntervalMs (clamped to a minimum of 1000); unset uses the SDK’s periodic-export default.
  • Logs: OTLP logs respect logging.level (file log level) and use the diagnostic log-record redaction path, not console formatting. High-volume installs should prefer OTLP collector sampling/filtering over local sampling. Set diagnostics.otel.logsExporter: "stdout" when your platform already ships stdout/stderr to a log processor and you have no OTLP logs collector. Stdout records are one JSON object per line with ts, signal, service.name, severity, body, redacted attributes, and trusted trace fields when available.
  • File-log correlation: JSONL file logs include top-level traceId, spanId, parentSpanId, and traceFlags when the log call carries a valid diagnostic trace context, letting log processors join local log lines with exported spans.
  • Request correlation: Gateway HTTP requests and WebSocket frames create an internal request trace scope. Logs and diagnostic events inside that scope inherit the request trace by default, while agent run and model-call spans are created as children so provider traceparent headers stay on the same trace.
  • Model-call correlation: openclaw.model.call spans include safe prompt component sizes by default and per-call token attributes when the provider result exposes usage. openclaw.model.usage remains the run-level accounting span for aggregate cost, context, and channel dashboards, and stays on the same diagnostic trace when the emitting runtime has trusted trace context.