-
Notifications
You must be signed in to change notification settings - Fork 790
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
[sdk-metrics] Remove locking around exemplar updates in MetricPoint #5535
[sdk-metrics] Remove locking around exemplar updates in MetricPoint #5535
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5535 +/- ##
==========================================
+ Coverage 83.38% 85.52% +2.13%
==========================================
Files 297 289 -8
Lines 12531 12475 -56
==========================================
+ Hits 10449 10669 +220
+ Misses 2082 1806 -276
Flags with carried forward coverage won't be shown. Click here to find out more.
|
{ | ||
if (number < 0) | ||
{ | ||
this.CompleteUpdateWithoutMeasurement(); |
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.
bug fix? do we need changelog for this?
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.
You think it is worth mentioning? Before for measurements of < 0
against an exponential histogram we no-op the update but we still set MetricPointStatus = MetricPointStatus.CollectPending
which would cause the MetricPoint
to be collected during the next export. Not sure if that is actually a bug or just odd 🤣 For cumulative I don't think it would mean anything. For delta, maybe?
/cc @alanwest
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.
Pretty subtle and not very noteworthy. If it were just me, I'd skip the changelog, but if you feel differently, I'll volunteer some verbiage:
Fixed an issue where a zero-valued histogram metric point may be exported after recording a negative measurement. This could only occur when using the
Base2ExponentialHistogram
aggregation. Negative measurements against an exponential histogram are not supported and should be ignored.
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.
Since it does not have any substantial end user impact. I guess ok to skip it.
I pointed this out as I noticed the change looked unrelated to the PR.
Follow-up to #5465
Changes
MetricPoint
Benchmarks
Counter
Before
After
Without exemplar enabled counter should be essentially as it was before. With exemplar counter gets a bit faster because it now doesn't need to fuss with a lock acquire/release for most measurements.
Histogram
Before
After
Histogram without exemplar enabled should be essentially as it was before. Histogram with exemplar should actually be slower by one
Interlocked.Exchange
call. Hoping to improve that in follow-ups but it doesn't cost a whole lot.Stress test
Here is where these changes shine. The benchmarks above don't have any concurrency.
Setup
Stress test is run like this: OpenTelemetry.Tests.Stress.Metrics.exe -d 300 -t [Counter|Histogram] -o -e -v
Explanation of parameters:
-d
: Run test for 5 minutes.-t
: Run test either using Counters or Histograms.-o
: Enable OTLP export every 5000ms. This is done to measure impact of allocations, locks introduced during collection.-e
: Enable exemplars.-v
: Enable a view which filters down the tags. This increases contention by reducing the unique number ofMetricPoint
s being updated.Results
Before
Counter:
Histogram:
After
Counter:
For counters, throughput has more than doubled.
Histogram:
For histograms, throughput is better but still well behind counters.
Merge requirement checklist