You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "chihsuan (via GitHub)" <gi...@apache.org> on 2026/10/05 09:53:35 UTC

[PR] HDDS-16611. Use MutableGaugeLong for total count metrics in OMMetrics [ozone]

chihsuan opened a new pull request, #11410:
URL: https://github.com/apache/ozone/pull/11410

   ## What changes were proposed?
   
   Deleting keys caused a false spike in the Key Creation Rate dashboard.
   
   This PR:
   - Changes total counts in OMMetrics to gauges because they can increase or decrease.
   - Changes the dashboard query from `rate()` to `deriv()` and renames the panel to Key Count Change Rate.
   - Fixes `setNumFiles()` updating the directory count instead of the file count.
   
   Metric names stay the same.
   
   ## JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16611
   
   ## How was this patch tested?
   
   - Added a unit test for total counts and the `setNumFiles()` fix.
   - Updated integration tests to check totals as gauges.
   - Compose cluster: wrote 4000 keys, then deleted 2000.
   
   CI:
   https://github.com/chihsuan/ozone/actions/runs/37177485726
   
   Generated-by: Claude Code (Claude Opus 5.5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16611. Use MutableGaugeLong for total count metrics in OMMetrics [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #11410:
URL: https://github.com/apache/ozone/pull/11410#discussion_r4188839984


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java:
##########
@@ -340,28 +340,20 @@ public void incDataCommittedBytes(long bytesWritten) {
     totalDataCommitted.incr(bytesWritten);
   }
 
-  public void incNumS3Buckets() {
-    numS3Buckets.incr();
-  }
-
-  public void decNumS3Buckets() {
-    numS3Buckets.incr();
-  }
-

Review Comment:
   Can we handle the S3 metrics cleanup in a separate Jira? There seem to be other unused S3 metrics as well, so doing them together would keep this PR focused.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16611. Use MutableGaugeLong for total count metrics in OMMetrics [ozone]

Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on code in PR #11410:
URL: https://github.com/apache/ozone/pull/11410#discussion_r4183230318


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java:
##########
@@ -219,14 +220,14 @@ public class OMMetrics implements OmMetadataReaderMetrics {
 
   // Metrics for total number of volumes, buckets and keys
 
-  private @Metric MutableCounterLong numVolumes;
-  private @Metric MutableCounterLong numBuckets;
+  private @Metric MutableGaugeLong numVolumes;
+  private @Metric MutableGaugeLong numBuckets;
   private @Metric MutableCounterLong numS3Buckets;

Review Comment:
   Metric `numS3Buckets` and its methods have no usages in code, should we still consider changing it to gauge?
   
   



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java:
##########


Review Comment:
   Now that these are gauges - `decNumVolumes()`, `decNumBuckets()`, `decNumKeys()` and `decNumKeys(long)` can call `decr()` and `decr(val)`. 
   
   The negative `incr()` was a counter workaround.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java:
##########


Review Comment:
   `decNumS3Buckets()` is also incrementing the `numS3Buckets` which is incorrect. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16611. Use MutableGaugeLong for total count metrics in OMMetrics [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #11410:
URL: https://github.com/apache/ozone/pull/11410#discussion_r4188839984


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java:
##########
@@ -340,28 +340,20 @@ public void incDataCommittedBytes(long bytesWritten) {
     totalDataCommitted.incr(bytesWritten);
   }
 
-  public void incNumS3Buckets() {
-    numS3Buckets.incr();
-  }
-
-  public void decNumS3Buckets() {
-    numS3Buckets.incr();
-  }
-

Review Comment:
   Could we handle the S3 metrics cleanup in a separate Jira? There seem to be other unused S3 metrics as well, so doing them together would keep this PR focused.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16611. Use MutableGaugeLong for total count metrics in OMMetrics [ozone]

Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on PR #11410:
URL: https://github.com/apache/ozone/pull/11410#issuecomment-6034150596

   Thanks @chihsuan for the patch and @chungen0126 for the review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16611. Use MutableGaugeLong for total count metrics in OMMetrics [ozone]

Posted by "chihsuan (via GitHub)" <gi...@apache.org>.
chihsuan commented on code in PR #11410:
URL: https://github.com/apache/ozone/pull/11410#discussion_r4183604779


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java:
##########


Review Comment:
   Good point, switched to `decr()`.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java:
##########
@@ -219,14 +220,14 @@ public class OMMetrics implements OmMetadataReaderMetrics {
 
   // Metrics for total number of volumes, buckets and keys
 
-  private @Metric MutableCounterLong numVolumes;
-  private @Metric MutableCounterLong numBuckets;
+  private @Metric MutableGaugeLong numVolumes;
+  private @Metric MutableGaugeLong numBuckets;
   private @Metric MutableCounterLong numS3Buckets;

Review Comment:
   Good catch, it's been unused since HDDS-3385, so I removed it along with its dashboard panel.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java:
##########


Review Comment:
   Nice catch, removed it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16611. Use MutableGaugeLong for total count metrics in OMMetrics [ozone]

Posted by "chihsuan (via GitHub)" <gi...@apache.org>.
chihsuan commented on code in PR #11410:
URL: https://github.com/apache/ozone/pull/11410#discussion_r4196044064


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java:
##########
@@ -340,28 +340,20 @@ public void incDataCommittedBytes(long bytesWritten) {
     totalDataCommitted.incr(bytesWritten);
   }
 
-  public void incNumS3Buckets() {
-    numS3Buckets.incr();
-  }
-
-  public void decNumS3Buckets() {
-    numS3Buckets.incr();
-  }
-

Review Comment:
   Thank you! @chungen0126 @sarvekshayr 🙏  I've reverted the S3 cleanup change here and moved the cleanup to #11421.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16611. Use MutableGaugeLong for total count metrics in OMMetrics [ozone]

Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on code in PR #11410:
URL: https://github.com/apache/ozone/pull/11410#discussion_r4191564729


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java:
##########
@@ -340,28 +340,20 @@ public void incDataCommittedBytes(long bytesWritten) {
     totalDataCommitted.incr(bytesWritten);
   }
 
-  public void incNumS3Buckets() {
-    numS3Buckets.incr();
-  }
-
-  public void decNumS3Buckets() {
-    numS3Buckets.incr();
-  }
-

Review Comment:
   Yes, it's better to cleanup unused metrics in a seperate Jira. Created [HDDS-16726](https://issues.apache.org/jira/browse/HDDS-16726).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16611. Use MutableGaugeLong for total count metrics in OMMetrics [ozone]

Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr merged PR #11410:
URL: https://github.com/apache/ozone/pull/11410


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16611. Use MutableGaugeLong for total count metrics in OMMetrics [ozone]

Posted by "chihsuan (via GitHub)" <gi...@apache.org>.
chihsuan commented on PR #11410:
URL: https://github.com/apache/ozone/pull/11410#issuecomment-5993803055

   Thanks for the review! @sarvekshayr, I've addressed the comments, could you take another look when you have a chance?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org