-
Notifications
You must be signed in to change notification settings - Fork 239
Description
Summary
The elastic-apm-node package currently pins @opentelemetry/core to v1.x (via @opentelemetry/sdk-metrics@^1.12.0), which creates an unresolvable peer dependency conflict when users try to install packages that require @opentelemetry/core v2, such as @langfuse/otel in my case.
Problem
When attempting to install @langfuse/otel alongside [email protected], npm fails with the following error:
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: [email protected]
npm error Found: @opentelemetry/[email protected]
npm error node_modules/@opentelemetry/core
npm error @opentelemetry/core@"1.26.0" from @opentelemetry/[email protected]
npm error node_modules/@opentelemetry/resources
npm error @opentelemetry/resources@"1.26.0" from @opentelemetry/[email protected]
npm error node_modules/@opentelemetry/sdk-metrics
npm error @opentelemetry/sdk-metrics@"^1.12.0" from [email protected]
npm error node_modules/elastic-apm-node
npm error elastic-apm-node@"~4.15.0" from the root project
npm error @opentelemetry/core@"1.26.0" from @opentelemetry/[email protected]
npm error node_modules/@opentelemetry/sdk-metrics
npm error @opentelemetry/sdk-metrics@"^1.12.0" from [email protected]
npm error node_modules/elastic-apm-node
npm error elastic-apm-node@"~4.15.0" from the root project
npm error 1 more (elastic-apm-node)
npm error
npm error Could not resolve dependency:
npm error @langfuse/otel@"*" from the root project
npm error
npm error Conflicting peer dependency: @opentelemetry/[email protected]
npm error node_modules/@opentelemetry/core
npm error peer @opentelemetry/core@"^2.0.1" from @langfuse/[email protected]
npm error node_modules/@langfuse/otel
Root Cause
[email protected] depends on @opentelemetry/sdk-metrics@^1.12.0
This transitively pulls in @opentelemetry/[email protected]
@langfuse/[email protected] has a peer dependency on @opentelemetry/core@^2.0.1
These two version requirements are incompatible and cannot coexist
Impact
This prevents users from combining Elastic APM monitoring with newer OpenTelemetry-based observability tools like Langfuse. As more packages in the ecosystem migrate to OpenTelemetry v2, this incompatibility will affect an increasing number of users.
Requested Solution
Please update the OpenTelemetry dependencies to v2, specifically:
Update @opentelemetry/sdk-metrics to a v2-compatible version
Update any other @opentelemetry/* dependencies as needed to support the v2 ecosystem
Environment
elastic-apm-node version: 4.15.0
Node.js version: (applicable to all supported versions)
npm version: 10.x
Workarounds Attempted
Using --legacy-peer-deps or --force flags can sometimes work but may lead to runtime issues
No clean workaround exists that maintains both packages in a stable state
Additional Context
OpenTelemetry JS has released stable v2 versions of core packages, and the ecosystem is increasingly adopting these newer versions. The Langfuse SDK (and other modern observability tools) have moved to require v2, making this upgrade important for users who want to combine Elastic APM with other observability tooling.