Skip to content

Reuse DELTA metric aggregators across collections - #9049

Open
DOKL57 wants to merge 5 commits into
open-telemetry:mainfrom
DOKL57:fix/7729-delta-retained-handles
Open

DOKL57 wants to merge 5 commits into
open-telemetry:mainfrom
DOKL57:fix/7729-delta-retained-handles

Conversation

@DOKL57

@DOKL57 DOKL57 commented Nov 22, 2026

Copy link
Copy Markdown

Fixes #7729.

In REUSABLE_DATA mode, the two alternating maps can hold separate accumulators for the same unbound DELTA series. After eight collections of an explicit bucket histogram with 1,024 series, GC.class_histogram found 2,048 accumulators and 2,048 handle wrappers on main. This change retains 1,024 of each.

The maps keep their entries and share the reset accumulator. If a recording for the same series overlaps collection, the incoming interval gets its own accumulator and both maps keep that accumulator after the handoff. Bound handles continue to rotate, and idle series are evicted when the cardinality limit is reached.

Tests

./gradlew :sdk:metrics:check :sdk:all:jmhJar passed in WSL 2. The metrics module had 902 passing tests and one skipped test. Coverage includes reuse across empty intervals, overlapping recording and collection, binding a previously recorded series, and cardinality eviction.

JMH

Baseline f0549eb, patch 0e35619. JMH 1.37, JDK 25.0.5.1, two forks, three 1-second warmup iterations and four 1-second measurement iterations per fork. Collection workloads used one thread. The last two rows use the existing MetricRecordBenchmark without collection. Errors are JMH 99.9% confidence intervals. For collection, one op includes all records and one collect.

Workload Main, ops/s Patch, ops/s Main, B/op Patch, B/op
128 series × 1 record 25,371.5 ± 678.3 25,024.9 ± 1,488.2 176.3 104.3
1,024 series × 1 record 2,610.2 ± 375.7 3,001.6 ± 276.1 178.7 106.3
128 series × 32 records 6,055.2 ± 209.6 5,649.8 ± 279.1 177.2 105.2
1,024 series × 32 records 708.7 ± 19.6 702.0 ± 51.2 185.9 114.0
0 of 1,024 series active 48,971.8 ± 4,392.7 175,865.0 ± 29,808.8 40.1 40.0
128 of 1,024 series active 12,326.8 ± 1,055.0 21,497.2 ± 1,822.9 160.6 104.3
Record only, 1 thread 24,836,988 ± 3,595,279 26,508,544 ± 3,663,536 0.0 0.0
Record only, 4 threads 34,993,300 ± 1,514,838 31,649,532 ± 4,255,306 0.0 0.0

The initial throughput difference at 128 series × 32 records did not recur when alternating revisions. The run order was main at 5,234 ± 308, patch at 5,539 ± 821, patch at 5,941 ± 243, and main at 5,669 ± 288 ops/s. Four-thread recording had a lower mean on the patch and overlapping confidence intervals. Overlapping collection and recording was covered by functional tests.

@DOKL57
DOKL57 requested a review from a team as a code owner November 22, 2026 07:46
@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-11-22 10:13 UTC

Investigate required status check failures.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.49%. Comparing base (f0549eb) to head (7f21c3a).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9049      +/-   ##
============================================
+ Coverage     90.45%   90.49%   +0.03%     
- Complexity    11182    11211      +29     
============================================
  Files          1032     1032              
  Lines         30508    30559      +51     
  Branches       3992     4012      +20     
============================================
+ Hits          27596    27653      +57     
- Misses         1935     1936       +1     
+ Partials        977      970       -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REUSABLE_DATA memory mode creates duplicate aggregator handles in DELTA temporalit

1 participant