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 4a5d8da7a5abf155a2082a6df01190cd81e17e6b Author: Dom Garguilo <domgargu...@apache.org> AuthorDate: Fri May 24 10:44:15 2024 -0400 Use NanoTime to measure reservation time for scan server metrics --- .../src/main/java/org/apache/accumulo/tserver/ScanServer.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServer.java index 01fc9ccd67..616800168e 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServer.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/ScanServer.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.io.UncheckedIOException; import java.net.UnknownHostException; import java.nio.ByteBuffer; -import java.time.Duration; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -91,6 +90,7 @@ import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException; import org.apache.accumulo.core.util.Halt; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.core.util.threads.ThreadPools; +import org.apache.accumulo.core.util.time.NanoTime; import org.apache.accumulo.server.AbstractServer; import org.apache.accumulo.server.ServerContext; import org.apache.accumulo.server.client.ClientServiceHandler; @@ -672,11 +672,11 @@ public class ScanServer extends AbstractServer @VisibleForTesting ScanReservation reserveFilesInstrumented(Map<KeyExtent,List<TRange>> extents) throws AccumuloException { - long start = System.nanoTime(); + NanoTime start = NanoTime.now(); try { return reserveFiles(extents); } finally { - scanServerMetrics.recordTotalReservationTime(Duration.ofNanos(System.nanoTime() - start)); + scanServerMetrics.recordTotalReservationTime(start.elapsed()); } } @@ -713,11 +713,11 @@ public class ScanServer extends AbstractServer @VisibleForTesting ScanReservation reserveFilesInstrumented(long scanId) throws NoSuchScanIDException { - long start = System.nanoTime(); + NanoTime start = NanoTime.now(); try { return reserveFiles(scanId); } finally { - scanServerMetrics.recordTotalReservationTime(Duration.ofNanos(System.nanoTime() - start)); + scanServerMetrics.recordTotalReservationTime(start.elapsed()); } }