-
Notifications
You must be signed in to change notification settings - Fork 849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete bound instruments #5157
Delete bound instruments #5157
Conversation
Codecov ReportBase: 90.99% // Head: 91.07% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #5157 +/- ##
============================================
+ Coverage 90.99% 91.07% +0.08%
+ Complexity 4881 4863 -18
============================================
Files 545 548 +3
Lines 14498 14360 -138
Branches 1383 1375 -8
============================================
- Hits 13193 13079 -114
+ Misses 910 890 -20
+ Partials 395 391 -4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
359e9f1
to
bb8caa8
Compare
sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/SdkDoubleCounterTest.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/SdkDoubleHistogramTest.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/SdkDoubleUpDownCounterTest.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/SdkLongCounterTest.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/SdkLongHistogramTest.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/SdkLongUpDownCounterTest.java
Outdated
Show resolved
Hide resolved
LGTM! |
A while back there was an issue and PR to remove bound instruments. It's been over a year and there's been no movement on bound instruments in the spec, and they didn't end up being related to the batch callback API, which was added. Removing them saves ~1500 lines of code and gets rid of some of the trickiest code in the metrics SDK (tracking references to the bound instruments using high performance lock free techniques and bitshifting). After the optimizations I've been doing lately (#5154, #5142) the performance impact that bound instruments might have is small:
ConcurrentHashMap<Attributes,AggregatorHandle>
since the caller holds on to a reference to a specificAggregatorHandle
.AggregatorHandle
after collection. But we can get around this by adding an object pool ofAggregatorHandles
, and reusing handles after collection.I think it's unlikely that the performance benefit of saving a lookup of
Attributes
in a map would warrant the increased API surface area and reduced ergonomics of bound instruments.Deleting bound instruments results in a modest performance improvement on the hot path since there's less book keeping tracking whether bound storage handles have references. See the before and after.