-
Notifications
You must be signed in to change notification settings - Fork 773
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
Histogram handle of double.NaN
bounds and values
#3279
Conversation
It also correctly will place `double.NaN` values in the final histogram bucket
double.NaN
bounds and values
@@ -30,7 +30,7 @@ public class ExplicitBucketHistogramConfiguration : MetricStreamConfiguration | |||
/// Requirements: | |||
/// <list type="bullet"> | |||
/// <item>The array must be in ascending order with distinct | |||
/// values.</item> | |||
/// values. double.NaN is not allowed</item> |
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.
What about other IEEE754 subnormal (e.g. -Inf)?
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 callout. I could do a follow up change for other subnormals.
@reyang @alanwest How should we treat subnormals being used as bounds or values.
I assume bounds, we should throw exception. But for values, there's decisions to be made (SDK specific) of whether we should have them affect bucket counts (and which bucket), sum, min, and max for histograms. But I guess this also expands to the other instrument types.
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.
Check these:
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.
The 2nd link applies to exponential histogram, but many ideas might be helpful for explicit bucket histogram, too.
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.
Nice. Hadn't seen the new wording for exponential histograms. I think it makes sense to follow this for explicit-bound histograms too. That is, effectively drop all sub-normal values from affecting min, max, and sum. I also think this wording would suggest that it is ok to not modify bucket counts either:
because these values do not map into a valid 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.
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 for Sum, the challenge is that even if we don't take subnormal as the input, the output could still be subnormal:
opentelemetry-dotnet/test/OpenTelemetry.Exporter.Prometheus.Tests/PrometheusSerializerTests.cs
Lines 176 to 186 in d983cb1
counter.Add(1.0E308); | |
counter.Add(1.0E308); | |
provider.ForceFlush(); | |
var cursor = PrometheusSerializer.WriteMetric(buffer, 0, metrics[0]); | |
Assert.Matches( | |
("^" | |
+ "# TYPE test_counter counter\n" | |
+ "test_counter \\+Inf \\d+\n" | |
+ "$").Replace('\'', '"'), |
@CodeBlanch I changed how recording a |
@mic-max PrometheusExporter is still experimental, feel free to make changes to it (including the tests) if you think it makes sense (based on what the latest Stable SDK spec says). |
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. |
Fixes #3171
Changes
double.NaN
values in the final histogram bucketdouble.NaN
is used as a histogram boundFor significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes