sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Support OpenTelemetry SDK v2

Open mydea opened this issue 10 months ago • 3 comments

Description

Today, the Node SDK uses & supports the OpenTelemetry SDK in version 1.x.

Since v2 was released, we should look into supporting this as well.

This is, as of now, a breaking change, as anybody using @sentry/node with custom stuff that depends on OTEL v1 will have breakage once we update this.

Because of this, we will likely cut a v10 release soon-ish that only bumps OTEL to v2.

There are a few pieces to this:

  1. Widen ranges of peerDependencies in @sentry/opentelemetry to allow both v1 and v2 (if possible - this can already happen on v9!)
  2. On v10 branch, bump the used versions of dependencies of @sentry/node to v2 of the OTEL SDKs a. We need to make sure that all instrumentations we use (e.g. prisma, remix, ...) are also on v2 first!
  3. While we are at this, we may re-visit how we handle/support users with custom OTEL setups. Today, it is pretty hard to make this work because we ship our own versions of everything, which easily conflicts with user versions. In order to solve this, we want to introduce a @sentry/node-core SDK, which does not include any OTEL dependencies (but instead has peerDependency ranges defined). This SDK ships without any instrumentations out of the box. It can be used both by users that want a custom OTEL setup, as well as for scenarios where you only need manual instrumentation (e.g. CLIs or similar). See https://github.com/getsentry/sentry-javascript/issues/15213

Experimental work for this is being done here: https://github.com/getsentry/sentry-javascript/pull/15518

mydea avatar Mar 19 '25 13:03 mydea

This is currently a blocker for us, we hope to see a compatible release soon

patroza avatar Apr 09 '25 12:04 patroza

Any news on this one?

dcaffull-fds avatar Jun 09 '25 08:06 dcaffull-fds

@dcaffull-fds we're actively working on this. Once this is ready for users to try out we'll update in this GH issue. Thanks!

AbhiPrasad avatar Jun 09 '25 13:06 AbhiPrasad

Am I right to assume that the fruit of this labour will arrive in the Sentry 10.x release?

I have an open ticket to upgrade to opentelemetry v2, but this issue in Sentry has been blocking me since spring. Knowing it will come in 10.x will at least let me snooze until that clear signal arrives :)

klippx avatar Jul 16 '25 09:07 klippx

@klippx yes, this will land with v10 of our SDKs.

andreiborza avatar Jul 16 '25 09:07 andreiborza

Hi, we recently shipped a new @sentry/node-core SDK that comes with a widened peer dependency range on OpenTelemetry and without any OpenTelemetry auto instrumentations out of the box. This SDK is now at the base of @sentry/node.

We suggest users with custom OpenTelemetry setups to use this SDK over @sentry/node with the caveat that anything tracing related has to be set up by users themselves.

For users that are fine with the OpenTelemetry setup @sentry/node ships with but would like to give OpenTelemetry v2 a try, we have a v10 alpha.

We'd love if you could give this a try and provide feedback here or in newly filed issues.

andreiborza avatar Jul 24 '25 13:07 andreiborza

v10 has now been released which marks the completion of this project. We'd appreciate hearing back from folks with custom OTel setups and their experience. Feel free to file new issues on the repo.

andreiborza avatar Jul 31 '25 16:07 andreiborza