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

duong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 4dc859fbf3 HDDS-9580. Introduce metric for listkeys (#5529)
4dc859fbf3 is described below

commit 4dc859fbf382f74f83f739a6e7829f24e7838bb5
Author: muskan1012 <[email protected]>
AuthorDate: Thu Dec 14 11:52:49 2023 +0530

    HDDS-9580. Introduce metric for listkeys (#5529)
---
 .../org/apache/hadoop/ozone/om/OMPerformanceMetrics.java    | 13 +++++++++++++
 .../java/org/apache/hadoop/ozone/om/OmMetadataReader.java   | 12 ++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMPerformanceMetrics.java
 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMPerformanceMetrics.java
index 25223c502c..7ac97a538c 100644
--- 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMPerformanceMetrics.java
+++ 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMPerformanceMetrics.java
@@ -113,6 +113,11 @@ public class OMPerformanceMetrics {
   @Metric(about = "Ratis local command execution latency in nano seconds")
   private MutableRate validateAndUpdateCacneLatencyNs;
 
+  @Metric(about = "ACLs check latency in listKeys")
+  private MutableRate listKeysAclCheckLatencyNs;
+
+  @Metric(about = "resolveBucketLink latency in listKeys")
+  private MutableRate listKeysResolveBucketLatencyNs;
 
   public void addLookupLatency(long latencyInNs) {
     lookupLatencyNs.add(latencyInNs);
@@ -210,4 +215,12 @@ public class OMPerformanceMetrics {
   public MutableRate getValidateAndUpdateCacneLatencyNs() {
     return validateAndUpdateCacneLatencyNs;
   }
+
+  public MutableRate getListKeysAclCheckLatencyNs() {
+    return listKeysAclCheckLatencyNs;
+  }
+
+  public MutableRate getListKeysResolveBucketLatencyNs() {
+    return listKeysResolveBucketLatencyNs;
+  }
 }
diff --git 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataReader.java
 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataReader.java
index 6b390ccbba..7c332788d2 100644
--- 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataReader.java
+++ 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataReader.java
@@ -325,8 +325,10 @@ public class OmMetadataReader implements 
IOmMetadataReader, Auditor {
   public ListKeysResult listKeys(String volumeName, String bucketName,
       String startKey, String keyPrefix, int maxKeys) throws IOException {
     long startNanos = Time.monotonicNowNanos();
-    ResolvedBucket bucket = ozoneManager.resolveBucketLink(
-        Pair.of(volumeName, bucketName));
+    ResolvedBucket bucket = captureLatencyNs(
+        perfMetrics.getListKeysResolveBucketLatencyNs(),
+        () -> ozoneManager.resolveBucketLink(
+            Pair.of(volumeName, bucketName)));
 
     boolean auditSuccess = true;
     Map<String, String> auditMap = bucket.audit();
@@ -336,8 +338,10 @@ public class OmMetadataReader implements 
IOmMetadataReader, Auditor {
 
     try {
       if (isAclEnabled) {
-        checkAcls(ResourceType.BUCKET, StoreType.OZONE, ACLType.LIST,
-            bucket.realVolume(), bucket.realBucket(), keyPrefix);
+        captureLatencyNs(perfMetrics.getListKeysAclCheckLatencyNs(), () ->
+            checkAcls(ResourceType.BUCKET, StoreType.OZONE, ACLType.LIST,
+            bucket.realVolume(), bucket.realBucket(), keyPrefix)
+        );
       }
       metrics.incNumKeyLists();
       return keyManager.listKeys(bucket.realVolume(), bucket.realBucket(),


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to