openclaw/extensions/diagnostics-otel
Zhiling Chen 11a0e54ddd
improve(diagnostics-otel): make agent-duration histograms usable beyond 10s (#96592)
* improve(diagnostics-otel): tune duration/context histogram bucket boundaries

The openclaw.run.duration_ms, openclaw.harness.duration_ms, and
openclaw.context.tokens histograms used the SDK default bucket
boundaries. The default duration buckets top out at 10s, so agent runs —
which routinely take minutes — all collapse into the +Inf overflow
bucket, making p95/p99 latency meaningless without collector-side
reconfiguration.

Add explicit_bucket_boundaries advice via named constants, matching the
existing GEN_AI_*_BUCKETS convention in this file:
- AGENT_DURATION_MS_BUCKETS (1s … 1h) for the run and harness duration
  histograms, which share the same range.
- CONTEXT_TOKENS_BUCKETS on a token scale (1k … 2M). openclaw.context.tokens
  records context-window limit/used token counts (e.g. 128000), so the
  boundaries must cover real context sizes rather than small integers.

Adds a test asserting the three histograms advertise the expected
boundaries and that run/harness share the same set.

* fix(diagnostics-otel): preserve prior histogram buckets

---------

Co-authored-by: Harry Chen <zhiling.chen@binance.com>
Co-authored-by: Vincent Koc <25068+vincentkoc@users.noreply.github.com>
2026-07-07 19:13:05 -07:00
..
src improve(diagnostics-otel): make agent-duration histograms usable beyond 10s (#96592) 2026-07-07 19:13:05 -07:00
api.ts fix(diagnostics-otel): surface error message on run/harness error spans (#101244) 2026-07-07 04:29:39 +01:00
index.ts test(qa): add provider runtime evidence (#101051) 2026-07-06 13:01:32 -07:00
npm-shrinkwrap.json chore: update dependencies (#100027) 2026-07-04 14:56:50 -04:00
openclaw.plugin.json Add stdout diagnostics OTEL log exporter 2026-06-19 16:06:37 +10:00
package.json chore(release): close out 2026.6.11 on main 2026-06-30 11:31:08 -07:00
README.md Add stdout diagnostics OTEL log exporter 2026-06-19 16:06:37 +10:00
runtime-api.ts test(qa): add provider runtime evidence (#101051) 2026-07-06 13:01:32 -07:00
tsconfig.json

@openclaw/diagnostics-otel

Official OpenTelemetry diagnostics exporter for OpenClaw.

This plugin exports OpenClaw Gateway traces, metrics, and logs to an OTLP collector for observability stacks such as Grafana, Datadog, Honeycomb, New Relic, Tempo, and compatible collectors. It can also write diagnostic log records as stdout JSONL for container log pipelines.

Install

openclaw plugins install @openclaw/diagnostics-otel

Restart the Gateway after installing or updating the plugin.

Configure

Enable the plugin and set the OTLP endpoint in plugins.entries.diagnostics-otel.config.

The full config surface, metric names, span names, and collector examples live in the docs:

Package

  • Plugin id: diagnostics-otel
  • Package: @openclaw/diagnostics-otel
  • Minimum OpenClaw host: 2026.4.25