BP-69: Convert stats and allocator modules to slog (phase 2)#4755
Open
merlimat wants to merge 4 commits intoapache:masterfrom
Open
BP-69: Convert stats and allocator modules to slog (phase 2)#4755merlimat wants to merge 4 commits intoapache:masterfrom
merlimat wants to merge 4 commits intoapache:masterfrom
Conversation
Minimal scaffolding commit for the BP-69 slog migration series: - Add `io.github.merlimat.slog:slog:0.9.7` to the root pom.xml dependencyManagement and to the global compile classpath alongside the existing SLF4J API (which stays as the rendering backend). - Add lombok.config at the repo root so `@CustomLog` generates a slog `Logger` instead of an SLF4J one. - Register the slog jar in LICENSE-all.bin.txt, LICENSE-server.bin.txt and LICENSE-bkctl.bin.txt so the CI check-binary-license script finds it accounted for in the bundled-jars list. No actual Java file is converted in this commit. Individual module migrations stack on top of this one.
Part of BP-69. Converts the stats-api, codahale/otel/prometheus metrics providers, stats-utils, and bookkeeper-common-allocator modules.
4 tasks
This was referenced Apr 24, 2026
Pulls in the MDC propagation fix from merlimat/slog#6, which makes log4j2 ThreadContext entries visible on slog events emitted via the Log4j2Logger backend (so %X{key} layouts and appenders that read event.getContextData().getValue(key) see the caller's MDC).
zymap
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of the slog migration for BP-69. Tracking issue: #4750.
This PR stands alone — it does not depend on the bookkeeper-common PR (#4754) landing first. The 2 commits are:
526e9ac7ecBP-69 base: add slog dependency and LICENSE entries — minimal scaffolding:io.github.merlimat.slog:slog:0.9.7topom.xml(alongside SLF4J; SLF4J stays as the rendering backend).lombok.configso@CustomLoggenerates a slogLogger.LICENSE-all.bin.txt,LICENSE-server.bin.txt,LICENSE-bkctl.bin.txt.db52607eb4Convert stats and allocator modules from SLF4J to slog — the actual conversion (9 files):stats/bookkeeper-stats-api:AlertStatsLogger,Stats,ThreadRegistry.stats/bookkeeper-stats-providers:CodahaleMetricsProvider,OtelMetricsProvider,PrometheusMetricsProvider,ThreadScopedDataSketchesStatsLogger.stats/utils/StatsDocGenerator.bookkeeper-common-allocator/ByteBufAllocatorImpl.If the bookkeeper-common PR (#4754) lands first, this PR will rebase cleanly onto it (the base commit here is a subset of what #4754 already contains, and will become empty on rebase).
Conventions applied
@Slf4j→@CustomLog;LoggerFactory.getLogger(X.class)→Logger.get(X.class); static =LOG, instance =log.log.info("text {} {}", a, b)→log.info().attr("a", a).attr("b", b).log("text").log.error("msg", throwable)→log.error().exception(throwable).log("msg").if (log.isDebugEnabled())guards removed.Notes
CodahaleMetricsProviderretains oneorg.slf4j.LoggerFactoryreference for the DropwizardSlf4jReporter.outputTo()call (that API takes an SLF4JLogger); the class's own logs are on slog.AlertStatsLogger.raise(String, Object...)keeps its vararg signature in this PR. The Map-based API change (raise(String, Map<String, Object>)) will land together with thestream/distributedlogconversion so the two sides stay in sync.Not included
stats/*+bookkeeper-common-allocatoris converted.Test plan
mvn -pl stats/...,bookkeeper-common-allocator -am compile -DskipTestspassesstats/*andbookkeeper-common-allocatorunit tests still passAlertStatsLoggercontinue to render correctly under Logback/Log4j2