-
Notifications
You must be signed in to change notification settings - Fork 785
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
Console exporter display exponential histogram buckets #4344
Console exporter display exponential histogram buckets #4344
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4344 +/- ##
==========================================
- Coverage 84.66% 84.59% -0.07%
==========================================
Files 298 298
Lines 11971 11990 +19
==========================================
+ Hits 10135 10143 +8
- Misses 1836 1847 +11
|
negativeBucketCounts = new List<string>(); | ||
} | ||
|
||
var lowerBound = Math.Exp(offset * factor).ToString("F6", CultureInfo.InvariantCulture); |
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.
Curious, where is this F6
coming from, does it provide a good precision (rather than having two different buckets printed out the same thing)?
|
||
if (exponentialHistogramData.ZeroCount != 0) | ||
{ | ||
bucketsBuilder.AppendLine($"Bucket [0, 0], Count: {exponentialHistogramData.ZeroCount}"); |
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.
I guess ZeroCount is for [0, IEEE754 epsilon / 2]
.
opentelemetry-dotnet/test/OpenTelemetry.Tests/Metrics/Base2ExponentialBucketHistogramTest.cs
Line 145 in 63de729
Assert.Equal(-1075, histogram.MapToIndex(IEEE754Double.FromString("0 00000000000 0000000000000000000000000000000000000000000000000001"))); // ~4.9406564584124654E-324 (minimum subnormal positive, double.Epsilon, 2 ^ -1074) |
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.
From a learning perspective, I think the output helps folk derive an intuition for exponential histograms. I'm not opposed to getting more technical and surfacing up details of the underlying IEEE 754 representation of things, but I wonder if it's helpful.
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.
I think it'll be really bad if we have the wrong math here.
I suggest that either we use the right math, or don't use math (e.g. instead of saying [0, 0]
, use English - zero bucket
)
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.
English works for me.
} | ||
|
||
var lowerBound = Math.Exp(offset * factor).ToString("F6", CultureInfo.InvariantCulture); | ||
var upperBound = Math.Exp(++offset * factor).ToString("F6", CultureInfo.InvariantCulture); |
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.
Is this going to give the accurate IEEE 754 representation or there will be drifts due to precision losses or we don't know?
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.
I'm pretty confident this is absolutely imprecise 😆. I guess we need to consider the audience and use case we're trying to serve.
To me this verbose format is mainly for learning, debugging, non-production kind of use cases.
F6
truncates things to 6 decimal places so that the width of the output is somewhat fixed and easier to read. I chose 6 simply because that's what the collector seems to display (might just be default formatting in Go).
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.
I essentially implemented the LowerBoundary
reverse mapping method here
My understanding is that this is valid for both positive and negative scales. There is a note about the possibility that the maximum index is incorrectly computed as +Inf
. I can verify.
Is this discrepancy in the outputs expected? ConsoleExporter
Collector
|
Good eye. Had the bounds reversed. Fixed. You might have also noticed the difference in the interval notation. This is a bug in the collector. I fixed it yesterday open-telemetry/opentelemetry-collector#7445 |
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Uses same format as the collector. For sake of comparison, I've included the output from our exporter and the collector's exporter using the following code.
Code
.NET console exporter
Collector logging exporter