Skip to content

ref(vercel-edge): Remove @opentelemetry/resources dependency#21690

Merged
andreiborza merged 1 commit into
developfrom
ab/drop-otel-resources-direct-dep
Jun 22, 2026
Merged

ref(vercel-edge): Remove @opentelemetry/resources dependency#21690
andreiborza merged 1 commit into
developfrom
ab/drop-otel-resources-direct-dep

Conversation

@andreiborza

Copy link
Copy Markdown
Member

The bundled BasicTracerProvider from @opentelemetry/sdk-trace-base statically imports defaultResource from @opentelemetry/resources as a fallback (mergedConfig.resource ?? defaultResource()).But we always supply our own ownresource via getSentryResource(), so the fallback never runs. The import only needs to resolve.

So we shim @opentelemetry/resources to a tiny inlined stub during bundling so the real package is never bundled, then remove it from dependencies.

This also avoids pulling OTel's node-only resource detectors into the edge runtime.

Closes: #20983

The bundled `BasicTracerProvider` from `@opentelemetry/sdk-trace-base` statically
imports `defaultResource` from `@opentelemetry/resources` as a fallback
(`mergedConfig.resource ?? defaultResource()`).But we always supply our own
ownresource via `getSentryResource()`, so the fallback never runs. The import
only needs to resolve.

So we shim `@opentelemetry/resources` to a tiny inlined stub during bundling so
the real package is never bundled, then remove it from `dependencies`.

This also avoids pulling OTel's node-only resource detectors into the edge
runtime.
@andreiborza andreiborza marked this pull request as ready for review June 22, 2026 12:50
@andreiborza andreiborza requested a review from a team as a code owner June 22, 2026 12:50
@andreiborza andreiborza requested review from JPeer264, mydea and nicohrubec and removed request for a team June 22, 2026 12:50
@andreiborza andreiborza merged commit 2e29cd3 into develop Jun 22, 2026
82 checks passed
@andreiborza andreiborza deleted the ab/drop-otel-resources-direct-dep branch June 22, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace @opentelemetry/resources

2 participants