This is an automated email from the ASF dual-hosted git repository. krathbun pushed a commit to branch 3.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit d3c54640cc2b53235e5021781cc182c580700bc7 Merge: 46c4c37646 f297977bc7 Author: Kevin Rathbun <kevinrr...@gmail.com> AuthorDate: Mon Mar 3 17:59:38 2025 -0500 Merge branch '2.1' into 3.1 .../metrics/CompactionExecutorsMetrics.java | 60 ++++++++++++---------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/CompactionExecutorsMetrics.java index 7f5a5b96af,c2aefb6bdf..71352950b4 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/CompactionExecutorsMetrics.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/CompactionExecutorsMetrics.java @@@ -60,6 -57,19 +60,19 @@@ public class CompactionExecutorsMetric private IntSupplier runningSupplier; private IntSupplier queuedSupplier; + private CeMetrics(CompactionExecutorId ceid) { + if (registry != null) { - this.queued = registry.gauge(METRICS_MAJC_QUEUED, Tags.of("id", ceid.canonical()), ++ this.queued = registry.gauge(MAJC_QUEUED.getName(), Tags.of("id", ceid.canonical()), + new AtomicInteger(0)); - this.running = registry.gauge(METRICS_MAJC_RUNNING, Tags.of("id", ceid.canonical()), ++ this.running = registry.gauge(MAJC_RUNNING.getName(), Tags.of("id", ceid.canonical()), + new AtomicInteger(0)); + } else { + // these vars have no effect on metrics in this case - just avoids NPEs + this.queued = new AtomicInteger(0); + this.running = new AtomicInteger(0); + } + } + @Override public void close() { runningSupplier = () -> 0; @@@ -69,9 -79,22 +82,22 @@@ } } - private static class ExMetrics { - AtomicInteger queued; - AtomicInteger running; + private class ExMetrics { + private final AtomicInteger queued; + private final AtomicInteger running; + + private ExMetrics(CompactionExecutorId ceid) { + if (registry != null) { - this.queued = registry.gauge(METRICS_MAJC_QUEUED, Tags.of("id", ceid.canonical()), ++ this.queued = registry.gauge(MAJC_QUEUED.getName(), Tags.of("id", ceid.canonical()), + new AtomicInteger(0)); - this.running = registry.gauge(METRICS_MAJC_RUNNING, Tags.of("id", ceid.canonical()), ++ this.running = registry.gauge(MAJC_RUNNING.getName(), Tags.of("id", ceid.canonical()), + new AtomicInteger(0)); + } else { + // these vars have no effect on metrics in this case - just avoids NPEs + this.queued = new AtomicInteger(0); + this.running = new AtomicInteger(0); + } + } } public CompactionExecutorsMetrics() {