Skip to content

diagnostics-otel plugin fails with OTel v2.x: Resource is not a constructor #10385

@chrisbaker2000

Description

@chrisbaker2000

Bug Description

The diagnostics-otel plugin fails to initialize when enabled, preventing OpenTelemetry tracing from working.

Error Message

TypeError: _resources.Resource is not a constructor

Root Cause

@opentelemetry/resources v2.5.0 introduced a breaking change that removed the Resource class. The package now exports resourceFromAttributes instead.

The transpiled code references _resources.Resource, suggesting the TypeScript import import { Resource } from "@opentelemetry/resources" is still being used somewhere in the dependency chain.

Steps to Reproduce

  1. Add OTEL config to openclaw.json:
"diagnostics": {
  "otel": {
    "enabled": true,
    "endpoint": "https://api.honeycomb.io:443",
    "headers": { "x-honeycomb-team": "YOUR_API_KEY" },
    "serviceName": "openclaw"
  }
}
  1. Restart the gateway
  2. Plugin fails to load with the above error

Expected Behavior

The diagnostics-otel plugin should initialize and export traces to the configured OTEL endpoint.

Environment

  • OpenClaw: latest (as of 2026-02-06)
  • Node: v24.10.0
  • OS: macOS Darwin 25.1.0 (arm64)
  • @opentelemetry/resources: v2.5.0 (or whichever version is in the dependency tree)

Suggested Fix

Update the OTel SDK imports to use the new v2.x API:

// Before (v1.x)
import { Resource } from "@opentelemetry/resources";
const resource = new Resource({ ... });

// After (v2.x)
import { resourceFromAttributes } from "@opentelemetry/resources";
const resource = resourceFromAttributes({ ... });

Or pin the OTel packages to v1.x until the codebase can be updated for v2.x compatibility.

Labels

  • bug
  • otel
  • diagnostics

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