Skip to content

Commit

Permalink
fix(#18): attempt to switch to native histograms
Browse files Browse the repository at this point in the history
  • Loading branch information
novoj committed May 27, 2024
1 parent 98c1673 commit 8c5c5cc
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
Expand Down Expand Up @@ -301,13 +302,19 @@ private static Metric buildAndRegisterMetric(@Nonnull LoggedMetric metric, @Nonn
ofNullable(metric.histogramSettings())
.ifPresentOrElse(
settings -> {
builder.classicExponentialUpperBounds(settings.start(), settings.factor(), settings.count());
builder.nativeOnly()
.nativeInitialSchema(-1)
.nativeMaxNumberOfBuckets(14)
.nativeResetDuration(24, TimeUnit.HOURS);
if (!settings.unit().isBlank()) {
builder.unit(new Unit(settings.unit()));
}
},
() -> builder.classicExponentialUpperBounds(1, 2.0, 14)
.unit(new Unit("milliseconds")));
() -> builder.nativeOnly()
.nativeInitialSchema(-1)
.nativeMaxNumberOfBuckets(14)
.nativeResetDuration(24, TimeUnit.HOURS)
.unit(new Unit("milliseconds")));
yield builder
.labelNames(metric.labels())
.help(metric.helpMessage())
Expand Down

0 comments on commit 8c5c5cc

Please sign in to comment.