Skip to content

Remove @opentelemetry/instrumentation dependency from @sentry/node #22759

Description

@andreiborza

After removing the iitm-based instrumentations (#22346) and the deprecated InstrumentationBase-derived classes, @sentry/node no longer registers any OpenTelemetry/import-in-the-middle module patchers. But it still depends on @opentelemetry/instrumentation for a handful of live imports. This ticket tracks vendoring/reimplementing those so we can drop the dependency, mirroring the @opentelemetry/core removal effort in #21674.

Remaining consumers (as of #22346 end state)

Live code imports:

  • packages/node/src/otel/instrument.tsregisterInstrumentations, Instrumentation (type). Backs generateInstrumentOnce, which is a public export (src/index.ts).
  • packages/node/src/utils/ensureIsWrapped.tsisWrapped. Used by the Express/Koa/Hapi/Fastify error-handler setup to warn if the app object wasn't wrapped.

Type-only imports (trivial to inline):

  • packages/node/src/integrations/http/SentryHttpInstrumentation.tsInstrumentationConfig, base of the public SentryHttpInstrumentationOptions.
  • packages/node/src/integrations/tracing/redis/vendored/types.tsInstrumentationConfig, base of the redis cache option types used by cache.ts.

Work

  • Reimplement or vendor registerInstrumentations + the Instrumentation type behind generateInstrumentOnce (or evaluate whether generateInstrumentOnce still needs to exist at all now that nothing internal calls it — it only remains as a public export).
  • Reimplement/vendor isWrapped (small shimmer helper).
  • Inline the two InstrumentationConfig type usages.
  • Drop @opentelemetry/instrumentation from packages/node/package.json.

Notes

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions