Skip to content

node-opentelemetry: app spans aren't recorded when the app uses OpenTelemetry JS 3 (@opentelemetry/api 1.10) #326

Open

Description

@volodymyrshk

With @hyperdx/node-opentelemetry 0.11.0 in an app on OpenTelemetry JS 3 (@opentelemetry/api 1.10), spans the app creates through the API are not recording after init(), so they are never exported. The same code on API 1.9.1 records.

Repro

mkdir hdx-otel3 && cd hdx-otel3 && npm init -y && npm pkg set type=module
npm install @hyperdx/[email protected] @opentelemetry/[email protected] @opentelemetry/[email protected]

app.mjs:

import { init } from '@hyperdx/node-opentelemetry';
import { trace } from '@opentelemetry/api';
init({ apiKey: 'test', service: 'svc' });
await new Promise((r) => setTimeout(r, 300));
const span = trace.getTracer('app').startSpan('work');
console.log('recording:', span.isRecording());
span.end();
process.exit(0);
OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:9 node app.mjs
# recording: false

Control: the same script after npm install @hyperdx/[email protected] @opentelemetry/[email protected] prints recording: true.

Cause

The install ends up with two copies of the API:

1.10.0  node_modules/@opentelemetry/api
1.9.1   node_modules/@hyperdx/node-opentelemetry/node_modules/@opentelemetry/api

@hyperdx/node-opentelemetry lists @opentelemetry/api ^1.9.1 as a dependency, and its OTel SDK 2.x packages (sdk-node 0.218, core 2.x) need an API below 1.10, so npm nests 1.9.1 for it. init() registers the tracer provider through that copy. The app's 1.10 copy treats a global registered by an older minor as incompatible and returns a no-op tracer.

Node 25.6.1, npm 11.

Possible fixes

  • Move the Node SDK to OpenTelemetry JS 3 (sdk-node 0.301, @opentelemetry/sdk-trace in place of sdk-trace-base), which shares the app's API 1.10.
  • Or, until then, cap the supported API in the docs and warn at init() when a second API copy is detected, so the data loss isn't silent.

I'm happy to open a PR for whichever direction you prefer.

Activity

  1. added
    external
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

external

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions