Bug Description
The diagnostics-otel plugin initializes correctly (SDK starts, real Meter/Tracer obtained), but never receives any diagnostic events. This is because the plugin-sdk's event system is disconnected from the core's event emitter.
Root Cause
There are two separate listener sets that are never connected:
-
Core emitter (extensionAPI.js):
const listeners$3 = /* @__PURE__ */ new Set();
function emitDiagnosticEvent(event) {
// ...
for (const listener of listeners$3) { ... }
}
-
Plugin SDK (plugin-sdk/index.js):
const listeners = /* @__PURE__ */ new Set();
function onDiagnosticEvent(listener) {
listeners.add(listener);
return () => listeners.delete(listener);
}
When the diagnostics-otel plugin calls onDiagnosticEvent() from openclaw/plugin-sdk, it registers to the plugin-sdk's listeners Set. But when the core emits events via emitDiagnosticEvent(), they go to listeners$3 in extensionAPI.js — a completely separate Set.
Steps to Reproduce
- Configure diagnostics-otel plugin with a working OTLP endpoint (e.g., SigNoz Cloud)
- Enable diagnostics in config:
{
"plugins": { "allow": ["diagnostics-otel"] },
"diagnostics": {
"enabled": true,
"otel": {
"enabled": true,
"endpoint": "https://ingest.us.signoz.cloud:443",
"traces": true,
"metrics": true,
"logs": true
}
}
}
- Restart gateway
- Generate activity (send messages)
- Check OTLP backend — no traces or metrics appear
Verification
Added debug logging to the plugin:
diagnostics-otel: SDK started (traces=true, metrics=true)
diagnostics-otel: meter=Meter, tracer=Tracer // Real, not NoopMeter!
diagnostics-otel: logs exporter enabled (OTLP/HTTP)
But no "received event" logs ever appear — onDiagnosticEvent callback is never called.
Expected Behavior
The plugin-sdk's onDiagnosticEvent should register with the same listener set that the core's emitDiagnosticEvent uses, so plugins receive diagnostic events.
Environment
- OpenClaw version: 2026.2.6-3
- Node: v22.18.0
- OS: macOS (Darwin 24.6.0 arm64)
Suggested Fix
Either:
- Have plugin-sdk re-export the core's event functions instead of defining separate ones
- Bridge the two listener sets during plugin initialization
- Use a shared event bus module imported by both
Bug Description
The
diagnostics-otelplugin initializes correctly (SDK starts, real Meter/Tracer obtained), but never receives any diagnostic events. This is because the plugin-sdk's event system is disconnected from the core's event emitter.Root Cause
There are two separate listener sets that are never connected:
Core emitter (
extensionAPI.js):Plugin SDK (
plugin-sdk/index.js):When the
diagnostics-otelplugin callsonDiagnosticEvent()fromopenclaw/plugin-sdk, it registers to the plugin-sdk'slistenersSet. But when the core emits events viaemitDiagnosticEvent(), they go tolisteners$3in extensionAPI.js — a completely separate Set.Steps to Reproduce
{ "plugins": { "allow": ["diagnostics-otel"] }, "diagnostics": { "enabled": true, "otel": { "enabled": true, "endpoint": "https://ingest.us.signoz.cloud:443", "traces": true, "metrics": true, "logs": true } } }Verification
Added debug logging to the plugin:
But no "received event" logs ever appear —
onDiagnosticEventcallback is never called.Expected Behavior
The plugin-sdk's
onDiagnosticEventshould register with the same listener set that the core'semitDiagnosticEventuses, so plugins receive diagnostic events.Environment
Suggested Fix
Either: