Skip to content

Observability plugin support for external telemetry adapters #3915

Closed as not planned
Closed as not planned

Description

@jyaunches

Problem

NemoClaw is starting to receive requests for concrete observability integrations, such as built-in Prometheus metrics endpoints. We do not want core to accumulate one-off exporter implementations for every monitoring backend.

Instead, NemoClaw should expose a stable observability plugin surface that lets external adapters consume core lifecycle and operation telemetry without requiring each integration to be merged into the main repo.

Desired direction

Create a generic observability plugin extension point where NemoClaw core can emit stable telemetry events and out-of-tree plugins can translate those events into backend-specific integrations.

Examples of adapters that should be possible outside core:

  • Prometheus metrics endpoint/exporter
  • OpenTelemetry exporter
  • Datadog/New Relic/etc. adapters
  • Internal CI or fleet-monitoring adapters

Initial design goals

  • Keep NemoClaw core backend-agnostic.
  • Provide stable event names and payload shapes for key lifecycle/operation events.
  • Avoid adding exporter-specific dependencies to core.
  • Support opt-in registration/configuration for observability plugins.
  • Document how a plugin can subscribe to events and expose its own exporter/service.
  • Preserve zero/near-zero overhead when no observability plugin is enabled.

Candidate event families

  • Blueprint plan/apply execution start/finish/failure/duration
  • Endpoint/API key validation start/finish/failure/duration
  • Sandbox lifecycle operations start/finish/failure/duration
  • Plugin registration/start/stop events
  • Future policy/security decision events if needed

Relationship to PR #2494 / issue #233

PR #2494 implemented a concrete Prometheus-compatible /metrics endpoint in core. Rather than merging that specific integration, this issue tracks the architectural path that would let Prometheus be implemented as an external observability adapter.

Issue #233 captured the original built-in Prometheus proposal and is superseded by this more generic plugin-support direction.

Acceptance criteria

  • A documented observability plugin API exists.
  • Core emits a minimal set of stable telemetry events.
  • Plugins can subscribe to those events without patching core execution paths.
  • At least one example or skeleton adapter demonstrates the intended pattern.
  • Documentation explains how a Prometheus adapter could be implemented out-of-tree.

Activity

  1. jyaunches commented on May 20, 2026

    @jyaunches
    ContributorAuthor

    @wscurran We closed PR #2494 because we do not want to merge Prometheus as a one-off in-core exporter, but this issue is the path we want instead.

    The proposed path is:

    1. Define a small, stable observability event API in core for lifecycle/operation telemetry.
    2. Let plugins subscribe to those events through the normal plugin registration path.
    3. Keep exporter-specific HTTP servers, dependencies, and formatting logic out of core.
    4. Use a Prometheus adapter as the first example consumer once the extension point exists.

    A good first design pass would be to identify the minimal event set and payload schema needed to recreate the metrics from PR #2494 without coupling core to Prometheus itself.

  2. added
    area: integrations
    area: observability
    enhancement
    and removed on Jun 3, 2026
  3. removed
    enhancement
    on Jun 8, 2026
  4. tsushanth commented on Jun 21, 2026

    @tsushanth

    Picking up the "first design pass" framing — here's a minimal event set + payload schema that lets an out-of-tree Prometheus adapter recreate everything #2494 exposed, without core depending on Prometheus.

    #2494's metrics reduce to three operation families plus labels:

    #2494 metric labels
    blueprint_execution_total, _duration_seconds action, profile, status
    api_validation_total kind, source, status
    sandbox_lifecycle_total, _duration_seconds operation, status

    All of those are derivable from one finish event per operation carrying its attributes + outcome + duration, emitted from the existing call sites:

    • blueprint.execution.finish — end of plan/apply in blueprint/runner.ts
    • endpoint.validation.finish — around validateEndpointUrl in blueprint/ssrf.ts
    • sandbox.lifecycle.finish — around openshell sandbox create|stop|remove in blueprint/runner.ts
    • plugin.registration.finish — once in register() in index.ts
    // nemoclaw/src/observability/events.ts
    export const OBSERVABILITY_SCHEMA_VERSION = 1 as const;
    
    type Status = "success" | "error";
    
    interface BaseEvent {
      schemaVersion: typeof OBSERVABILITY_SCHEMA_VERSION;
      durationMs: number;        // core supplies it; adapters never call Date.now
      status: Status;
      errorKind?: string;        // closed code on error, never a raw message
    }
    
    export type ObservabilityEvent =
      | (BaseEvent & { event: "blueprint.execution.finish"; action: "plan" | "apply" | "status" | "rollback"; profile: string })
      | (BaseEvent & { event: "endpoint.validation.finish"; kind: "endpoint_url"; source: string })
      | (BaseEvent & { event: "sandbox.lifecycle.finish"; operation: "create" | "stop" | "remove" })
      | (BaseEvent & { event: "plugin.registration.finish" });

    errorKind is deliberately a closed vocabulary, not an error string — so no hostnames/URLs/secrets/stack traces ever reach a third-party adapter (also addresses #2494's own unauthenticated-/metrics note).

    For subscription I'd mirror the existing registerService/registerProvider shape with a core-owned registry (module singleton) — registerObservabilityAdapter({ id, events?, onEvent }) + an internal emit(). emit() early-returns when no adapters are registered (zero overhead, payload built behind that guard) and wraps each onEvent in try/catch (a slow/throwing adapter can't break core). The Prometheus registry, label formatting, and /metrics server from #2494 all move into the adapter; core ships none of it.

    Two open questions:

    1. Registry home — core module singleton (no change to the OpenClaw plugin host) vs. a new api.registerObservabilityAdapter on the host. Former is mergeable today; latter is cleaner long-term. Preference?
    2. The issue lists "future policy/security decision events." Those fit this channel as another *.finish family (a network/inference policy decision with a closed decision/reason vocabulary), so the schema stays forward-compatible without committing now.

    If the event set + core-singleton direction looks right, happy to put up a small PR — events.ts + registry + the four emit sites + a skeleton example adapter (no Prometheus dep in core) — so #2494 can be reimplemented out-of-tree. Happy to shape it however you'd like.

  5. jyaunches commented on Jul 10, 2026

    @jyaunches
    ContributorAuthor

    Closing as superseded cleanup: observability work has moved into more concrete adapter/runtime tracks, including DCode OTLP support in #6340 and newer extension/SDK planning. This broad external telemetry adapter issue is no longer the active tracking item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: integrationsarea: observability

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions