Bug Description
The diagnostics-otel plugin fails to load with the following error:
TypeError: _resources.Resource is not a constructor
Root Cause
The plugin code uses:
import { Resource } from "@opentelemetry/resources";
const resource = new Resource({...});
However, in @opentelemetry/resources@2.5.0, Resource is exported as a type only:
export type { Resource } from './Resource';
The actual implementation is exported via factory functions:
export { resourceFromAttributes, defaultResource, emptyResource } from './ResourceImpl';
Expected Behavior
Plugin should load successfully and export telemetry to the configured OTel collector.
Actual Behavior
Plugin fails to load with TypeError, preventing diagnostics from working.
Fix Suggestion
Update extensions/diagnostics-otel/src/service.ts to use the factory functions instead:
import { defaultResource } from "@opentelemetry/resources";
import { SEMRESATTRS_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
// Instead of:
// const resource = new Resource({...});
// Use:
const resource = defaultResource().merge(
resourceFromAttributes({
[SEMRESATTRS_SERVICE_NAME]: serviceName,
// ... other attributes
})
);
Environment
- OpenClaw version: 2026.2.3
@opentelemetry/resources: 2.5.0
@opentelemetry/api: 1.9.0
- Node.js: 22-bookworm
Steps to Reproduce
- Enable
diagnostics-otel plugin in openclaw.json
- Start gateway
- Observe plugin fails to load with TypeError
Workaround
Currently disabling the plugin until a fix is available.
Bug Description
The
diagnostics-otelplugin fails to load with the following error:Root Cause
The plugin code uses:
However, in
@opentelemetry/resources@2.5.0,Resourceis exported as a type only:The actual implementation is exported via factory functions:
Expected Behavior
Plugin should load successfully and export telemetry to the configured OTel collector.
Actual Behavior
Plugin fails to load with TypeError, preventing diagnostics from working.
Fix Suggestion
Update
extensions/diagnostics-otel/src/service.tsto use the factory functions instead:Environment
@opentelemetry/resources: 2.5.0@opentelemetry/api: 1.9.0Steps to Reproduce
diagnostics-otelplugin inopenclaw.jsonWorkaround
Currently disabling the plugin until a fix is available.