fix(diagnostics-otel): update to @opentelemetry/resources v2.x API#2574
Closed
dillera wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(diagnostics-otel): update to @opentelemetry/resources v2.x API#2574dillera wants to merge 1 commit intoopenclaw:mainfrom
dillera wants to merge 1 commit intoopenclaw:mainfrom
Conversation
The Resource class was removed in @opentelemetry/resources v2.x. Use resourceFromAttributes() function instead of new Resource(). Fixes TypeError: _resources.Resource is not a constructor
Author
|
bots helping bots |
This was referenced Jan 29, 2026
Member
|
Created a new PR at #12897 |
bfc1ccb to
f92900f
Compare
Contributor
|
AI-assisted stale triage closure (2026-02-23). Closing this PR as superseded. Why this is being closed:
This is AI-closed housekeeping, not a rejection of the contribution. If any missing pieces remain, please open a fresh PR from latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
diagnostics-otelplugin fails to load with:Root Cause
The
@opentelemetry/resourcespackage v2.x removed theResourceclass export. The new API usesresourceFromAttributes()function instead.From the package's index.js (v2.5.0):
Note: No
Resourceclass is exported.Fix
import { Resource }withimport { resourceFromAttributes }new Resource({...})withresourceFromAttributes({...})Testing
Tested locally on macOS with Node 22.22.0 — plugin now loads successfully and exports telemetry to Honeycomb.
Found while debugging with Clawdbot 🤖
Greptile Overview
Greptile Summary
Updates the
diagnostics-otelplugin to match@opentelemetry/resourcesv2.x by switching from the removedResourceclass to the newresourceFromAttributes()API, fixing the runtimeTypeError: Resource is not a constructorwhen the plugin starts.Change is localized to
extensions/diagnostics-otel/src/service.ts, where the constructed resource passed intoNodeSDK/LoggerProvidernow usesresourceFromAttributes({ [SemanticResourceAttributes.SERVICE_NAME]: serviceName }).Confidence Score: 5/5
(2/5) Greptile learns from your feedback when you react with thumbs up/down!