fix(opentelemetry-bridge): update to OTel SDK 2.x, fix opentelemetryBridgeEnabled to cover metrics integration#5126
Merged
Conversation
🤖 GitHub commentsJust comment with:
|
…cs to 2.x Bumps `@opentelemetry/core` and `@opentelemetry/sdk-metrics` from 1.x to 2.8.0. This picks up the upstream fix for CVE-2026-54285 (unbounded `baggage` header processing) in `@opentelemetry/core`. The OTel Metrics SDK 2.x has breaking API changes that required updating the agent's metrics integration: - The aggregation classes (`ExplicitBucketHistogramAggregation`, `SumAggregation`, `LastValueAggregation`, `DropAggregation`) were removed in favour of `AggregationOption` config objects keyed by `AggregationType`. - `MeterProvider.addMetricReader()` was removed; metric readers must now be passed via the constructor `readers` option. Updated `lib/opentelemetry-metrics`, the `@opentelemetry/sdk-metrics` instrumentation, the OTel metrics test fixtures, and the example to the 2.x API. The minimum supported `@opentelemetry/sdk-metrics` version for instrumentation is now 2.0.0. Co-authored-by: Cursor <cursoragent@cursor.com>
gsoldevila
force-pushed
the
chore/opentelemetry-2x
branch
from
June 29, 2026 16:00
11d7ffe to
98cf439
Compare
🔍 Preview links for changed docs |
✅ Elastic Docs Style Checker (Vale)No issues found on modified lines! The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale. |
gsoldevila
marked this pull request as ready for review
June 29, 2026 16:09
…entelemetryBridgeEnabled - Extend the `opentelemetryBridgeEnabled` config setting to *also* cover the integration with `@opentelemetry/sdk-metrics`. This was an oversight with OTel Metrics support was added after the initial support for OTel Tracing. This handles elastic#4956 - Ensure that `@opentelemetry/*` libs are **only require'd if `opentelemetryBridgeEnabled` is true** and if the current running Node.js version is in the supported range for the included Node.js SDK. If a user explicitly tries to enable the OTel Bridge, but is using too old of a Node.js version (e.g. 14 or 16), then the APM agent will log a warning and set `opentelemetryBridgeEnabled = false`. These changes allow the OpenTelemetry integration support to update the internally included `@opentelemetry/*` libs without hard breaking usage of the APM agent with older Node.js versions. It *does* mean that the OpenTelemetry Bridge no longer works with Node.js 14 and 18 (requires "^18.19.0 || >=20.6.0"). This is breaking for those users, but the Bridge is experimental, so that is allowed in minor releases. Closes: elastic#4956
…tests; refactor to avoid circular import and interaction with hooking of sdk-metrics package
opentelemetryBridgeEnabled to cover metrics integration
…=true is used for metrics integration
david-luna
reviewed
Jul 7, 2026
david-luna
approved these changes
Jul 7, 2026
This was referenced Jul 7, 2026
Merged
Member
|
@gsoldevila elastic-apm-node@4.18.0 is out with the upgrade to OTel SDK 2.x libs (#5137). |
2 tasks
gsoldevila
added a commit
to elastic/kibana
that referenced
this pull request
Jul 13, 2026
## Summary - Bumps `elastic-apm-node` from `4.15.0` to `4.18.0` - `4.17.0` fixes IPv6 URL parsing errors (`Could not set destination context: Invalid URL`) reported in [sdh-apm#2043](elastic/sdh-apm#2043) - `4.18.0` also updates OpenTelemetry 2.x dependencies ([apm-agent-nodejs#5126](elastic/apm-agent-nodejs#5126)) Renovate has not opened this bump yet due to the 14-day `minimumReleaseAge` on the APM dependency group. ## Test plan - [ ] CI green - [ ] Verify Kibana starts with default APM config Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
qn895
pushed a commit
to qn895/kibana
that referenced
this pull request
Jul 13, 2026
## Summary - Bumps `elastic-apm-node` from `4.15.0` to `4.18.0` - `4.17.0` fixes IPv6 URL parsing errors (`Could not set destination context: Invalid URL`) reported in [sdh-apm#2043](elastic/sdh-apm#2043) - `4.18.0` also updates OpenTelemetry 2.x dependencies ([apm-agent-nodejs#5126](elastic/apm-agent-nodejs#5126)) Renovate has not opened this bump yet due to the 14-day `minimumReleaseAge` on the APM dependency group. ## Test plan - [ ] CI green - [ ] Verify Kibana starts with default APM config Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
biamalveiro
pushed a commit
to biamalveiro/kibana
that referenced
this pull request
Jul 14, 2026
## Summary - Bumps `elastic-apm-node` from `4.15.0` to `4.18.0` - `4.17.0` fixes IPv6 URL parsing errors (`Could not set destination context: Invalid URL`) reported in [sdh-apm#2043](elastic/sdh-apm#2043) - `4.18.0` also updates OpenTelemetry 2.x dependencies ([apm-agent-nodejs#5126](elastic/apm-agent-nodejs#5126)) Renovate has not opened this bump yet due to the 14-day `minimumReleaseAge` on the APM dependency group. ## Test plan - [ ] CI green - [ ] Verify Kibana starts with default APM config Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades
@opentelemetry/coreand@opentelemetry/sdk-metricsfrom 1.x to 2.8.0, and migrates the agent's OTel Metrics integration to the 2.x SDK API.This picks up the upstream fix for CVE-2026-54285 (unbounded
baggageheader processing) in@opentelemetry/core, which is currently pulled in transitively at1.30.1byelastic-apm-node(via@opentelemetry/sdk-metrics@^1.12.0).This supersedes the dependabot-only bumps (#5097, #5095, #5113) which fail CI because they bump the dependency without migrating the calling code to the 2.x API.
Update(@trentm): This also extends the
opentelemetryBridgeEnabledconfig setting to also cover OTel Metrics integration, only allows the setting to be true for new-enough Node.js versions, ensures@opentelemetry/deps are only require'd if the setting is enabled.See 50577ce
Closes: #4956
What changed
OTel Metrics SDK 2.x has two breaking changes that the agent relied on:
ExplicitBucketHistogramAggregation,SumAggregation,LastValueAggregation, andDropAggregationare replaced byAggregationOptionconfig objects keyed byAggregationType.MeterProvider.addMetricReader()removed. Metric readers must now be passed via the constructorreadersoption.Files updated:
lib/opentelemetry-metrics/ElasticApmMetricExporter.js— aggregation config objects +AggregationTypeimport;selectAggregationnow returns anAggregationOption.lib/opentelemetry-metrics/index.js—MeterProviderreader passed via constructor.lib/instrumentation/modules/@opentelemetry/sdk-metrics.js—ApmMeterProviderappends the agent's reader to user-suppliedreadersand passes them tosuper(); supported-version guard moved to>=2.0.0 <3.test/opentelemetry-metrics/fixtures/*andexamples/opentelemetry-metrics/use-otel-metrics-sdk.js— migrated to the 2.x API (plain view-option objects,readers).package.json+ lockfiles (root and fixtures) bumped tocore/sdk-metrics2.8.0.Test plan
node test/opentelemetry-metrics/fixtures.test.js— 85/85 pass locally (this is the suite that fails on the dependabot-only PRs).eslintclean on all changed files.lint:tavandtest:depspass.test-versmatrix across Node versions) — needs maintainer run.@opentelemetry/sdk-metricsbump to2.0.0is acceptable (drops auto-instrumentation of userMeterProviders on 1.x SDKs).Made with Cursor