-
Notifications
You must be signed in to change notification settings - Fork 936
Sync instrument stress test #7986
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
base: main
Are you sure you want to change the base?
Sync instrument stress test #7986
Conversation
| AggregationTemporality aggregationTemporality, | ||
| InstrumentType instrumentType, | ||
| MemoryMode memoryMode, | ||
| InstrumentValueType instrumentValueType) { |
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.
Parameterized testing really shines here.
| Uninterruptibles.joinUninterruptibly(collectThread); | ||
|
|
||
| // Assert collected data is consistent with recorded measurements by independently computing the | ||
| // expected aggregated value and comparing to the actual results. |
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.
This is the key bit. We independently compute the expected aggregated state outside the concurrent record environment, and compare against the SDK, treating it as a black box.
sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/SynchronousInstrumentStressTest.java
Outdated
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7986 +/- ##
============================================
- Coverage 90.16% 90.16% -0.01%
+ Complexity 7478 7473 -5
============================================
Files 836 833 -3
Lines 22550 22524 -26
Branches 2224 2235 +11
============================================
- Hits 20333 20308 -25
+ Misses 1515 1512 -3
- Partials 702 704 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I'm doing some work to improve the performance of metric recording under high contention, and touching sensitive code in
DefaultSynchronousMetricStorageand other concurrent code.I have promising results, but the first step is buffing up our stress tests for synchronous instruments.
A stress test for synchronous instruments concurrently runs record and collect operations at a high rate, and tries to find instances of concurrency bugs: lost writes, duplicate writes, partial writes, etc.
We need to test every combination of of the following dimensions, since each plays a key role in the recording and collecting code flows.
That's 40 combinations. Our current test suite is hand rolled for some of these cases, but misses many.