npm / @opentelemetry/api
@opentelemetry/api
What changed in @opentelemetry/api 2, from its official release notes, upgrade guides and advisories. Also covers @opentelemetry/core, @opentelemetry/semantic-conventions. Sources checked 2026-10-18.
9 breaking1 security4 deprecations9 new APIs and options3 performance6 behavior and defaults7 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@opentelemetry/api 239 changes
Breaking changes 9
SimpleSpanProcessor.forceFlush() now rejects when a pending export fails.
In sdk-trace, the constructor now takes an options object containing the exporter instead of the exporter as its first argument.
In sdk-trace, the constructor now takes an options object containing the exporter and selfObsMeterProvider.
The limit is now enforced for event attributes.
The limit is now enforced for link attributes.
The limit is now enforced for event and link attributes.
The limit is now enforced for links.
Parsing now ignores the entire environment variable if any entry is invalid. Double-quotes remain part of values; encode leading or trailing whitespace with percent-encoding.
Corrected the overly broad type for otperformance, catching incompatible uses at compile time; use the target platform's performance implementation if affected.
Security 1
OpenTelemetry Core: Unbounded memory allocation in W3C Baggage propagation
Deprecations 4
The Jaeger propagator is deprecated in favor of W3CTraceContextPropagator; the package is planned for removal in SDK 3.x, approximately September 2026.
The package is planned for removal in SDK 3.x, approximately September 2026, following deprecation of OpenTracing compatibility requirements in the OpenTelemetry specification.
The TraceState implementation in api is deprecated.
AsyncHooksContextManager is deprecated.
New APIs and options 9
AsyncLocalStorageContextManager implements attach(), using AsyncLocalStorage.withScope() on Node.js 25.9+ and a manual disposable wrapper with enterWith() on older Node.js.
The force flush timeout can be configured per call.
Exporter metrics are implemented.
Log processor metrics are implemented.
Adds AlwaysRecordSampler to the trace SDK.
Adds a Trace SDK package without environment variable configuration handling; it is intended to eventually replace sdk-trace-base, sdk-trace-node, and sdk-trace-web.
Adds the maxExportBatchSize option to configure the maximum export batch size.
Implements metrics for span processors.
Span start/end metrics are implemented.
Performance 3
The method's performance is optimized.
The method's performance is optimized.
The method avoids Object.entries, improving performance.
Behavior and default changes 6
Concurrent forceFlush calls await ongoing exports and reuse a fresh concurrent export cycle, avoiding duplicate collection and export cycles.
set now returns the same TraceState instance when the key/value are invalid or make the whole trace state invalid.
unset now returns the same TraceState instance when the key is not present.
When best-effort parsing encounters duplicate keys, the most recent value wins.
The custom value from the environment variable for service.instance.id now takes priority over the random UUID backup.
A runtime check is used for the default service name.
Fixes and other changes 7
Exponential histograms now ignore Infinity.
Multiple calls to serviceInstanceIdDetector.detect() now return the same value for service.instance.id.
The sampler now includes trace IDs at the ratio 1 upper bound.
Extraction no longer throws on malformed percent-encoded uber-trace-id or uberctx-* headers.
Warning logs are no longer shown when a module is not marked as loaded.
The export avoids DOM types, improving compatibility in environments without DOM types.
Constructor input validation is improved, helping catch invalid inputs.