Skip to content
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 a hasBucketBoundaries() variant that allows specifying precision #5457

Conversation

mateuszrzeszutek
Copy link
Member

I ran into some issues with double metrics precision in open-telemetry/opentelemetry-java-instrumentation#8490 (comment), figured we might as well add a method varian that allows passing Offset

@mateuszrzeszutek mateuszrzeszutek requested a review from a team May 16, 2023 14:58
@codecov
Copy link

codecov bot commented May 16, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.04 🎉

Comparison is base (06cc7c1) 91.30% compared to head (07c3722) 91.34%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5457      +/-   ##
============================================
+ Coverage     91.30%   91.34%   +0.04%     
- Complexity     4887     4892       +5     
============================================
  Files           547      547              
  Lines         14404    14410       +6     
  Branches       1353     1354       +1     
============================================
+ Hits          13151    13163      +12     
+ Misses          867      864       -3     
+ Partials        386      383       -3     
Impacted Files Coverage Δ
...etry/sdk/testing/assertj/HistogramPointAssert.java 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

public HistogramPointAssert hasBucketBoundaries(double[] boundaries, Offset<Double> precision) {
isNotNull();
double[] actualBoundaries = actual.getBoundaries().stream().mapToDouble(d -> d).toArray();
Assertions.assertThat(actualBoundaries).as("boundaries").containsExactly(boundaries, precision);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we change the behavior of hasBucketBoundaries(double... boundaries) to include some default reasonable precision.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
How about 0.000001?

@jack-berg jack-berg merged commit 5676f46 into open-telemetry:main May 18, 2023
@mateuszrzeszutek mateuszrzeszutek deleted the hasBucketBoundaries-with-precision branch May 18, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants