Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
OpenTelemetry.Extensions.AzureMonitor - Add sampleRate attribute to SamplingResult. #623
OpenTelemetry.Extensions.AzureMonitor - Add sampleRate attribute to SamplingResult. #623
Changes from all commits
79da507
dcc3c46
1ac5a2b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Are we okay with the naive equality comparison for
float
?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 don't see an issue, do you think this could cause an issue?
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.
It depends on the sampler requirements. Do we want to sample and record for this value of sampling ratio
1.0000001
?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.
1.0000001
is an invalid valid. Guard in the constructor -Guard.ThrowIfOutOfRange((double)samplingRatio, min: 0.0, max: 1.0);
should throw an exception.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.
In general, equality comparison of floating-point values is problematic: https://docs.microsoft.com/en-us/dotnet/api/system.double?view=net-6.0#testing-for-equality
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
0.9999999F
?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.
This should not be treated as 1. Tested the behavior in a small test app, it works perfectly. I could understand the problem with float number, but it should not have impact on 0 and 1. As a follow up task we could add tests for this project to validate it.
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 was essentially asking this.
I know that the current code does not treat it as 1. I just wanted to know if we should be treating
0.9999999F
as1.0
and0.00000001F
as0.0
as when the user provides the samplingRatio, it might have been computed as result of other floating-point operation which might cause precision loss.