Skip to content

disable @opentelemetry/api instrumentation (for OTel Metrics API support) unless opentelemetryBridgeEnabled=true #4956

@trentm

Description

@trentm

Currently opentelemetryBridgeEnabled only controls whether the OTel Tracing API support is enabled. IOW, the "bridge" is somewhat confusingly sometimes just referring to the tracing API and not the metrics API. I think this is historical.

IMO, it is surprising that the wrapping of @opentelemetry/api's getMeterProvider can be active even if opentelemetryBridgeEnabled is false.

(Anecdotally this surprise was noticed in a crazy case where this led to a crash because the application in question was (a) using metrics.getMeter(...) from @opentelemetry/api, (b) without having registered a MeterProvider (which is the case where elastic-apm-node's wrapping with do work), (c) without the intention of using elastic-apm-node's bridge, (d) with elastic-apm-node enabled, and critically (e) with elastic-apm-node's dependency on @opentelemetry/sdk-node having been forced to the current v2 rather than the v1 is depends on.)

While this could be a breaking change, the OTel API support is experimental, so we could do so in a minor.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions