You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DurationBuckets.exponential fails due to fractional nanoseconds #47
DurationBuckets.exponential throws an IllegalArgumentException for large set of factors, because it is not possible to create a Duration based on a fractional nanosecond.:
java.lang.IllegalArgumentException: Unable to create a precise Duration with the specified factor
at com.uber.m3.util.Duration.multiply(Duration.java:313)
at com.uber.m3.tally.DurationBuckets.exponential(DurationBuckets.java:101)
The below code gives an idea of how I tried looking for a factor between 1 and 2 that can be used to create 20 buckets:
BigDecimal curr = new BigDecimal("1.01");
BigDecimal step = new BigDecimal("0.01");
BigDecimal end = new BigDecimal("1.99");
while (curr.compareTo(end) <= 0) {
try {
DurationBuckets.exponential(
Duration.ofMillis(1), curr.floatValue(), 20
);
System.out.println(curr);
} catch (IllegalArgumentException e) {}
curr = curr.add(step);
}
None of them work. This virtually renders DurationBuckets.exponential useless.
Activity