This is an automated email from the ASF dual-hosted git repository. domgarguilo pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit cc7e56c4d922ab1c6341ceb3ef6d7cb1a1c0a8a5 Merge: 9edd74bb06 5f571506dd Author: Dom Garguilo <domgargu...@apache.org> AuthorDate: Fri May 24 10:38:07 2024 -0400 Merge remote-tracking branch 'upstream/2.1' .../accumulo/core/metrics/MetricsProducer.java | 8 +++-- .../org/apache/accumulo/tserver/ScanServer.java | 11 ++++--- .../apache/accumulo/tserver/ScanServerMetrics.java | 38 ++++++++++++++++++---- .../apache/accumulo/test/metrics/MetricsIT.java | 6 ++-- 4 files changed, 46 insertions(+), 17 deletions(-) diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java index e555b8383e,1ba7de6e33..45cbdc6810 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServerMetrics.java @@@ -34,8 -36,10 +35,10 @@@ import io.micrometer.core.instrument.bi public class ScanServerMetrics implements MetricsProducer { - private Timer reservationTimer; + private Timer totalReservationTimer; + private Timer writeOutReservationTimer; - private Counter busyTimeoutCount; + private final AtomicLong busyTimeoutCount = new AtomicLong(0); + private final AtomicLong reservationConflictCount = new AtomicLong(0); private final LoadingCache<KeyExtent,TabletMetadata> tabletMetadataCache; @@@ -45,20 -49,41 +48,41 @@@ @Override public void registerMetrics(MeterRegistry registry) { - reservationTimer = Timer.builder(MetricsProducer.METRICS_SCAN_RESERVATION_TIMER) + totalReservationTimer = Timer.builder(MetricsProducer.METRICS_SCAN_RESERVATION_TOTAL_TIMER) .description("Time to reserve a tablets files for scan").register(registry); + writeOutReservationTimer = Timer + .builder(MetricsProducer.METRICS_SCAN_RESERVATION_WRITEOUT_TIMER) + .description("Time to write out a tablets file reservations for scan").register(registry); - busyTimeoutCount = Counter.builder(METRICS_SCAN_BUSY_TIMEOUT_COUNTER) + FunctionCounter.builder(METRICS_SCAN_BUSY_TIMEOUT_COUNTER, busyTimeoutCount, AtomicLong::get) .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); + FunctionCounter + .builder(METRICS_SCAN_RESERVATION_CONFLICT_COUNTER, reservationConflictCount, + AtomicLong::get) + .description( + "Counts instances where file reservation attempts for scans encountered conflicts") + .register(registry); + + if (tabletMetadataCache != null) { + Preconditions.checkState(tabletMetadataCache.policy().isRecordingStats(), + "Attempted to instrument cache that is not recording stats."); + CaffeineCacheMetrics.monitor(registry, tabletMetadataCache, + METRICS_SCAN_TABLET_METADATA_CACHE); + } + } + + public void recordTotalReservationTime(Duration time) { + totalReservationTimer.record(time); } - public Timer getReservationTimer() { - return reservationTimer; + public void recordWriteOutReservationTime(Runnable time) { + writeOutReservationTimer.record(time); } public void incrementBusy() { - busyTimeoutCount.increment(); + busyTimeoutCount.incrementAndGet(); } + + public void incrementReservationConflictCount() { + reservationConflictCount.getAndIncrement(); + } } diff --cc test/src/main/java/org/apache/accumulo/test/metrics/MetricsIT.java index 35efb186ef,3bb3353529..0b76970d6d --- a/test/src/main/java/org/apache/accumulo/test/metrics/MetricsIT.java +++ b/test/src/main/java/org/apache/accumulo/test/metrics/MetricsIT.java @@@ -99,10 -99,12 +99,10 @@@ public class MetricsIT extends Configur doWorkToGenerateMetrics(); cluster.stop(); - Set<String> unexpectedMetrics = Set.of(METRICS_SCAN_YIELDS, METRICS_UPDATE_ERRORS, - METRICS_REPLICATION_QUEUE, METRICS_COMPACTOR_MAJC_STUCK, METRICS_SCAN_BUSY_TIMEOUT_COUNTER); - // add sserver as flaky until scan server included in mini tests. - Set<String> flakyMetrics = Set.of(METRICS_GC_WAL_ERRORS, METRICS_FATE_TYPE_IN_PROGRESS, - METRICS_SCAN_BUSY_TIMEOUT_COUNTER, METRICS_SCAN_RESERVATION_TOTAL_TIMER, + Set<String> unexpectedMetrics = Set.of(METRICS_COMPACTOR_MAJC_STUCK, METRICS_SCAN_YIELDS); - Set<String> flakyMetrics = - Set.of(METRICS_FATE_TYPE_IN_PROGRESS, METRICS_GC_WAL_ERRORS, METRICS_SCAN_RESERVATION_TIMER, - METRICS_SCAN_BUSY_TIMEOUT_COUNTER, METRICS_SCAN_TABLET_METADATA_CACHE); ++ Set<String> flakyMetrics = Set.of(METRICS_FATE_TYPE_IN_PROGRESS, METRICS_GC_WAL_ERRORS, ++ METRICS_SCAN_RESERVATION_TOTAL_TIMER, METRICS_SCAN_BUSY_TIMEOUT_COUNTER, + METRICS_SCAN_TABLET_METADATA_CACHE); Map<String,String> expectedMetricNames = this.getMetricFields(); flakyMetrics.forEach(expectedMetricNames::remove); // might not see these