-
Notifications
You must be signed in to change notification settings - Fork 847
Reset scale of exponential histogram #6557
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?
Reset scale of exponential histogram #6557
Conversation
…m/hannahhaering/opentelemetry-dotnet into exponential-histogram-reset-scale
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6557 +/- ##
==========================================
- Coverage 86.67% 86.65% -0.02%
==========================================
Files 258 258
Lines 11895 11896 +1
==========================================
- Hits 10310 10309 -1
- Misses 1585 1587 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Seems reasonable to me. Please update the CHANGELOG.
src/OpenTelemetry/Metrics/MetricPoint/Base2ExponentialBucketHistogram.cs
Outdated
Show resolved
Hide resolved
this.runningValue.AsLong = 0; | ||
histogram.RunningSum = 0; | ||
histogram.Reset(); | ||
histogram.Reset(false); |
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.
These callsites would be more readable with a named-parameter:
histogram.Reset(false); | |
histogram.Reset(isMinMax: false); |
histogram.Reset(); | ||
histogram.RunningMin = double.PositiveInfinity; | ||
histogram.RunningMax = double.NegativeInfinity; | ||
histogram.Reset(true); |
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.
histogram.Reset(true); | |
histogram.Reset(isMinMax: true); |
else | ||
{ | ||
expectedHistogram.Reset(); | ||
expectedHistogram.Reset(aggregationType == AggregationType.HistogramWithMinMax); |
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.
expectedHistogram.Reset(aggregationType == AggregationType.HistogramWithMinMax); | |
expectedHistogram.Reset(isMinMax: aggregationType == AggregationType.HistogramWithMinMax); |
AssertExponentialBucketsAreCorrect(expectedHistogram, metricPoint.GetExponentialHistogramData()); | ||
Assert.Equal(50, sum); | ||
Assert.Equal(6, count); | ||
Assert.True(firstScale <= Metric.DefaultExponentialHistogramMaxScale); |
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.
Or some alternate message. We want more meaningful output in the logs if the test fails than "Expected true but got false".
Assert.True(firstScale <= Metric.DefaultExponentialHistogramMaxScale); | |
Assert.True(firstScale <= Metric.DefaultExponentialHistogramMaxScale, "The first scale value, {0}, is greater than Metric.DefaultExponentialHistogramMaxScale.", firstScale); |
Fixes #5635
Changes
Reset scale to 20 of the Base2 Exponential Bucket Histogram after each collection cycle when using delta aggregation temporality.
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes