Skip to content

Conversation

@JackTreble
Copy link

@JackTreble JackTreble commented Jul 14, 2025

What was changed

Support OpenTelemetry v2

Why?

So the latest versions of OpenTelemetry are supported going forward
This was a fairly naive update libraries job using the upgrade docs as a guide and the otel tests to check behaviour.

If you're reading this months in the future feel free to take on this PR, I may forget to come back to it!

Checklist

  1. Closes [Feature Request] Add support for opentelemetry v2 #1658

  2. How was this tested:

  • Using the test suite, although some unrelated tests failed locally. might be my setup?
  1. Any docs updates needed?

@CLAassistant
Copy link

CLAassistant commented Jul 14, 2025

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@JackTreble JackTreble marked this pull request as ready for review July 14, 2025 00:35
@JackTreble JackTreble requested a review from a team as a code owner July 14, 2025 00:35
@mjameswh
Copy link
Contributor

@JackTreble Thanks for your work on this, that looks awesome.

I'm a bit worried that this might be a breaking change for our users. Anything you can say about that? I suppose, for example, that users will need to simultaneously change their own code to also use OTel 2, and possibly also upgrade other OTel integration modules they have, right? Does OTel provide guidance for a smooth upgrade path?

In any case, we'll need to cross that bridge at one point or another, so I'd consider merging this as part of our next minor release. In the mean time, I'll leave this PR pending.

@JackTreble
Copy link
Author

@mjameswh Cheers.

I'm a bit worried that this might be a breaking change for our users

Yeah I think this change might be difficult to navigate,
From trying out the upgrade locally I only had to make minimal changes but that isn't going to be the same for everyone.

I think the best way forward could be be to retain support and add support for v2 in a separate package, allowing users to upgrade when best suits them.

I might be worrying about nothing but is there a risk that introducing this change increases the minimum supported node and typescript versions of this library?

I've not looked into what the minimum supported versions of the sdk are & how this minimum requirement in one module may affect the other modules so this might be a moot point.

Minimum supported versions from release notes

  • The minimum supported Node.js has been raised to ^18.19.0 || >=20.6.0. This means that support for Node.js 14 and 16 has been dropped.
  • The minimum supported TypeScript version has been raised to 5.0.4.
  • The compilation target for transpiled TypeScript has been raised to ES2022 (from ES2017) for all packages

Does OTel provide guidance for a smooth upgrade path?

The guidance on the repo is pretty comprehensive https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/upgrade-to-2.x.md

@mplachter
Copy link

mplachter commented Aug 25, 2025

Thoughts on supporting as two separate packages
interceptors-opentelemetry
interceptors-opentelemetry2 ?

@sdedovic
Copy link

sdedovic commented Aug 29, 2025

Two notes:

@victor-hugo-chimenez
Copy link

Hi folks!
First of all, thank you for all the hard work on this PR. OTel v2 support will really help a lot of us align our instrumentation across the stack.

Our team is currently instrumenting Temporal workflows with OpenTelemetry, and we’ve been holding off on some upgrades and waiting for this support to land.
I was wondering if there is anything we could do to help. We would be happy to assist or validate the implementation :shipit: 🙌

@airhorns
Copy link

It'd be great to get this in so we can upgrade -- AFAICT you can't run with both SDK versions at the same time, so we can't upgrade to 2.0 in userland if the temporal interceptors are still using 1.0, as the interceptors will send spans in the incorrect format to the exporters.

@sepehr500
Copy link

Just a heads up. LangFuse (and other LLMOps frameworks) require v2 of otel for compatibility. So given Temporal's push to be an llm agent framework, this will hold it back. Also, v1 otel will only be supported until February 2026 (I think) looking at this https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/upgrade-to-2.x.md

@enie123
Copy link

enie123 commented Dec 1, 2025

Another implementation with a few changes and version updates:
#1844

@mjameswh mjameswh changed the title chore: support opentelemetry v2 [HOLD] chore: support opentelemetry v2 Dec 1, 2025
@mjameswh
Copy link
Contributor

mjameswh commented Dec 1, 2025

This is coming up soon.

As I mentioned previously, we can't simply "upgrade" to OTel v2, as that would be a breaking change for all existing Temporal setups. The plan is therefore to make a new package for this, something like @temporalio/interceptors-opentelemetry2 (haven't made a final decision on the package name), so that both plugin versions can coexist.

Now, we're going through some heavy work to improve the completeness and DX on the OTel v1 interceptor at the moment. Those improvements will also be applicable to the v2, so much that it makes little sense to create the OTel v2 before we're done with present work on v1.

So the path forward will be, in proper order:

  1. Complete current efforts on covering all events through the OTel v1 interceptors
  2. Complete effort on extending the OTel interceptors v1 to the new Plugin form.
  3. Address serialization issues with the workflow/sink layer that are causing errors in some setups ([Bug] @temporalio/interceptors-opentelemetry OTEL bypasses a required SDK component #1779 and [Bug] opentelemetry traceState is handled properly in makeWorkflowExporter #1738).
  4. Duplicate the OTel v1 package to a new OTel v2 package, and adapt the code as needed.

In the mean time, you may use your own v2 copy of the OTel interceptors. There's really nothing here that requires that to be part of the official SDK.

I'll leave this PR open until then, so that other interested users may benefit from it.

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.

[Feature Request] Add support for opentelemetry v2

9 participants