mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-16 23:52:40 -06:00
d7def97638
Diagnostics exporters are plugin services that only ever start inside the Gateway process, so embedded `openclaw agent --local` turns emitted diagnostic events in the CLI process with no subscriber: zero spans, metrics, or logs reached the OTLP collector while identical Gateway- dispatched turns exported fine. The CLI now starts the `diagnostics-otel` service around embedded agent runs via a scoped, non-activating plugin load that honors the same plugin-enablement config as the Gateway, and flushes before exit: drain the async diagnostic-event queue, then shut the SDK down (force flush). Each step is bounded separately (5s drain, 10s flush) so an unreachable collector cannot hold the CLI open, and a stalled drain cannot consume the flush window and discard telemetry that was already buffered. When OTel is configured but the plugin is absent, the run now says so instead of exporting nothing with nothing explaining why. `diagnostics-prometheus` stays Gateway-only: it is a pull-based scrape server that is useless in a short-lived process and would race the Gateway for its port. No new config surface; configs without OTel enabled short-circuit before any plugin load. Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>