-
Notifications
You must be signed in to change notification settings - Fork 859
Add exponential histogram tests and in-memory exporter support #4303
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
Add exponential histogram tests and in-memory exporter support #4303
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4303 +/- ##
==========================================
+ Coverage 84.38% 84.48% +0.09%
==========================================
Files 298 298
Lines 11872 11875 +3
==========================================
+ Hits 10018 10032 +14
+ Misses 1854 1843 -11
|
| var copy = new ExponentialHistogramBuckets(); | ||
| copy.Offset = this.Offset; | ||
| copy.buckets = new long[this.buckets.Length]; | ||
| Array.Copy(this.buckets, copy.buckets, this.buckets.Length); |
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.
Copy size?
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.
Good catch, will fix.
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.
Turns out this was actually more insidious... I removed size altogether. Size was initialized wrong... this was never testing anything correctly.
This was a result of a refactor in my prior PR where I changed ExponentialHistogramBuckets from having a handle an instance of CircularBufferBuckets to simply a long[].
| Assert.True(metricPoints1Enumerator.MoveNext()); | ||
| ref readonly var metricPoint1 = ref metricPoints1Enumerator.Current; | ||
| Assert.Equal(1, metricPoint1.GetHistogramCount()); | ||
| Assert.Equal(10, metricPoint1.GetHistogramSum()); |
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.
Test for min and max as well.
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.
Yes, should probably take care of this on this PR. I noted a bug on the explicit bounds histograms where min/max is actually not captured currently in the snapshot, was gonna fix in another PR, but might just do it here since probably small.
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.
Min/max is now tested... gotta take off for the evening, so will fix explicit in a follow up
| public bool MoveNext() | ||
| { | ||
| if (this.index < this.size) | ||
| if (this.index < this.buckets.Length) |
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.
Shouldn't this be size? We are now always going enumerate over the full length of the CircularBufferBuckets instead of just enumerating from CircularBufferBuckets.begin to CircularBufferBuckets.end.
Adds some tests for exponential histogram configuration. Also adds InMemory exporter support.
Base2ExponentialBucketHistogramConfigurationis still internal so not adding a changelog entry with this PR.