-
Notifications
You must be signed in to change notification settings - Fork 881
Spatial aggregation for async instruments with filtering views #7264
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
Spatial aggregation for async instruments with filtering views #7264
Conversation
|
I'd like to discuss the test here. I would expect a cumulative sum instrument to aggregate all occurrences with empty attributes. Thus, I would expect to see To preserve this behavior, I clear the values for all the attributes at every collection, which is why |
Oh I forgot about a fundamental detail of asynchronous instruments: conceptually, when you make an observation with a cumulative instrument, we say that you are observing a cumulative value. Thus, if we have a reader with cumulative temporality which reads twice and invokes the callbacks twice, and the callback records the same value 3 each time, the reported value should indeed be 3 and not 6. Consider it from the perspective of this instrumentation which records information about classes loaded. If in sequential reads the callback records that 100 classes have been loaded, the output of a cumulative reader should always be 100, not N*100 (where N is the number of times the callback has been invoked). Instrumentation is not responsible for managing state and recording only the delta. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. This is pretty complex code when you consider the combinations of cumulative + delta, reusable + immutable data mode, and our desire to maintain zero memory allocations with reusable data mode after the application reaches steady state.
So reviews need to be slow / careful, but I am definitely interested in getting this issue resolved!
...rics/src/main/java/io/opentelemetry/sdk/metrics/internal/state/SdkObservableMeasurement.java
Show resolved
Hide resolved
...ics/src/main/java/io/opentelemetry/sdk/metrics/internal/state/AsynchronousMetricStorage.java
Outdated
Show resolved
Hide resolved
...ics/src/main/java/io/opentelemetry/sdk/metrics/internal/state/AsynchronousMetricStorage.java
Show resolved
Hide resolved
...ics/src/main/java/io/opentelemetry/sdk/metrics/internal/state/AsynchronousMetricStorage.java
Show resolved
Hide resolved
.../src/test/java/io/opentelemetry/sdk/metrics/internal/state/SdkObservableMeasurementTest.java
Show resolved
Hide resolved
Co-authored-by: jack-berg <[email protected]>
00264c9
to
561e479
Compare
Thanks for the clarification, I fixed the test accordingly |
Hi @jack-berg, are the test failure something I should be concerned of? They don't seem to be related to the diff |
The "windows-latest, 21" failure is unrelated, but the "ubunut-latest, 21" failure is: https://github.com/open-telemetry/opentelemetry-java/actions/runs/14524924371/job/40754298012?pr=7264#step:6:6005 This test codifies performance improvements we made with "reusuable data mode", and acts as a barrier to make sure we don't regress. If you compare the output of the benchmark on main to the output on this branch for the DELTA, REUSABLE_DATA, ASYNC_COUNTER case, we see an increase in B/op from |
3b3f85a
to
29f93c5
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7264 +/- ##
============================================
- Coverage 90.03% 89.90% -0.14%
+ Complexity 6916 6893 -23
============================================
Files 787 785 -2
Lines 20864 20791 -73
Branches 2023 2024 +1
============================================
- Hits 18785 18692 -93
- Misses 1441 1460 +19
- Partials 638 639 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hi @jack-berg, all green finally! I had to make some changes in The root cause is apparently the boxing due to the usage of |
...rc/main/java/io/opentelemetry/sdk/metrics/internal/aggregator/DoubleLastValueAggregator.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Although you forgot one thing - you've eliminated the need for Measurement
and all related code. I pushed a commit which deletes it and removes 345 lines! More functionality with less code!
Fixes #4901
I propose the following changes:
AsynchronousMetricStorage
now declaresvoid record(Attributes, long)
andvoid record(Attributes, double)
instead of a singlevoid record(Measurement)
, to enable usingAggregatorHandle
within the class.AsynchronousMetricStorage
now contains twolong
fields (startEpochNanos
,epochNanos
) which are injected before running the callbacks, as an alternative to passing aMeasurement
object.AsynchronousMetricStorage