This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/2.1 by this push:
     new 4d3a4d51b5 ensures instrumented cache is recording stats (#4552)
4d3a4d51b5 is described below

commit 4d3a4d51b506f779ac38d12e3a344fe8bef16560
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Tue May 21 12:34:56 2024 -0400

    ensures instrumented cache is recording stats (#4552)
---
 .../src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java   | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java
 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java
index 1a516b597b..771def8e4f 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java
@@ -23,6 +23,7 @@ import 
org.apache.accumulo.core.metadata.schema.TabletMetadata;
 import org.apache.accumulo.core.metrics.MetricsProducer;
 
 import com.github.benmanes.caffeine.cache.LoadingCache;
+import com.google.common.base.Preconditions;
 
 import io.micrometer.core.instrument.Counter;
 import io.micrometer.core.instrument.MeterRegistry;
@@ -46,6 +47,8 @@ public class ScanServerMetrics implements MetricsProducer {
         .description("Time to reserve a tablets files for 
scan").register(registry);
     busyTimeoutCount = Counter.builder(METRICS_SCAN_BUSY_TIMEOUT_COUNTER)
         .description("The number of scans where a busy timeout 
happened").register(registry);
+    Preconditions.checkState(tabletMetadataCache.policy().isRecordingStats(),
+        "Attempted to instrument cache that is not recording stats.");
     CaffeineCacheMetrics.monitor(registry, tabletMetadataCache, 
METRICS_SCAN_TABLET_METADATA_CACHE);
   }
 

Reply via email to