Skip to content

Commit

Permalink
fix(#18): switching back to classic histograms
Browse files Browse the repository at this point in the history
Unfortunately, Prometheus doesn't propagate native histograms in text format - see prometheus/prometheus#11265, only in Protobuff format, and this is not easily scrapeable.
  • Loading branch information
novoj committed May 27, 2024
1 parent 39dde78 commit 5b03ba7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@Name(AbstractQueryEvent.PACKAGE_NAME + ".Finished")
@Description("Event that is fired when a query is finished.")
@Label("Catalog finished")
@HistogramSettings(factor = 1.26, count = 40)
@HistogramSettings(factor = 1.65)
@ExportInvocationMetric(label = "Query finished")
@ExportDurationMetric(label = "Query duration in milliseconds")
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
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 @@ -302,15 +301,13 @@ private static Metric buildAndRegisterMetric(@Nonnull LoggedMetric metric, @Nonn
ofNullable(metric.histogramSettings())
.ifPresentOrElse(
settings -> {
builder.nativeOnly()
.nativeResetDuration(24, TimeUnit.HOURS);
builder.classicExponentialUpperBounds(settings.start(), settings.factor(), settings.count());
if (!settings.unit().isBlank()) {
builder.unit(new Unit(settings.unit()));
}
},
() -> builder.nativeOnly()
.nativeResetDuration(24, TimeUnit.HOURS)
.unit(new Unit("milliseconds")));
() -> builder.classicExponentialUpperBounds(1, 2.0, 14)
.unit(new Unit("milliseconds")));
yield builder
.labelNames(metric.labels())
.help(metric.helpMessage())
Expand Down

0 comments on commit 5b03ba7

Please sign in to comment.