Skip to content

diagnostics-otel plugin never receives events - disconnected event bus #11294

@pranay01

Description

@pranay01

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:

  1. Core emitter (extensionAPI.js):

    const listeners$3 = /* @__PURE__ */ new Set();
    function emitDiagnosticEvent(event) {
      // ...
      for (const listener of listeners$3) { ... }
    }
  2. 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

  1. Configure diagnostics-otel plugin with a working OTLP endpoint (e.g., SigNoz Cloud)
  2. 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
        }
      }
    }
  3. Restart gateway
  4. Generate activity (send messages)
  5. 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:

  1. Have plugin-sdk re-export the core's event functions instead of defining separate ones
  2. Bridge the two listener sets during plugin initialization
  3. Use a shared event bus module imported by both

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions