You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "sravani-revuri (via GitHub)" <gi...@apache.org> on 2026/08/13 06:01:12 UTC
[PR] HDDS-15333. Expose volume quota and namespace usage metrics in OM Prometheus endpoint. [ozone]
sravani-revuri opened a new pull request, #11011:
URL: https://github.com/apache/ozone/pull/11011
## What changes were proposed in this pull request?
Apache Ozone exposes bucket quota metrics from OM via /prom, for example:
bucket_utilization_metrics_bucket_used_bytes
bucket_utilization_metrics_bucket_quota_bytes
bucket_utilization_metrics_bucket_available_bytes
bucket_utilization_metrics_bucket_quota_namespace
These are useful for bucket byte quota monitoring, but there appear to be no equivalent Prometheus metrics for native volume quotas, even though volume quotas are available via the CLI/API.
Example CLI output:
ozone sh volume list
volume quotaInBytes quotaInNamespace
batch-accounting 1099511627776 -1
monitoring 10995116277760 -1
user -1 -1
Also, for buckets, the CLI exposes namespace usage:
ozone sh bucket info /user/ekleszcz
usedNamespace: 4
quotaInNamespace: 10
but OM /prom appears to expose only the namespace quota limit:
bucket_utilization_metrics_bucket_quota_namespace
and not a matching used namespace metric.
This makes it possible to monitor bucket byte quota usage, but not:
native volume quota usage
volume quota limits via Prometheus
bucket namespace quota usage percentage
Requested improvement:
Expose OM Prometheus metrics for:
volume used bytes
volume quota bytes
volume available bytes, if applicable
volume namespace quota
volume used namespace
bucket used namespace
This would allow operators to build Grafana dashboards and alerts for both volume and bucket quota usage without relying on custom exporters or CLI polling.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15333
## How was this patch tested?
written test and manual checking of metrics.
```
curl -s http://localhost:9874/prom | grep 'volume_utilization_metrics.*quotatest'
curl -s http://localhost:9874/prom | grep 'bucket_utilization_metrics_bucket_used_namespace.*metricsbucket'
volume_utilization_metrics_volume_quota_bytes{context="Volume metrics",volumename="quotatest",hostname="e4e7ec0ffb98"} 1073741824
volume_utilization_metrics_volume_quota_namespace{context="Volume metrics",volumename="quotatest",hostname="e4e7ec0ffb98"} 5
volume_utilization_metrics_volume_used_namespace{context="Volume metrics",volumename="quotatest",hostname="e4e7ec0ffb98"} 3
bucket_utilization_metrics_bucket_used_namespace{context="Bucket metrics",volumename="quotatest",bucketname="metricsbucket",hostname="e4e7ec0ffb98"} 4
```
--
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-15333. Expose volume quota and namespace usage metrics in OM Prometheus endpoint. [ozone]
Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on code in PR #11011:
URL: https://github.com/apache/ozone/pull/11011#discussion_r3811380132
##########
hadoop-ozone/interface-storage/src/main/java/org/apache/hadoop/ozone/om/OMMetadataManager.java:
##########
@@ -588,6 +588,9 @@ List<OmMultipartUpload> getMultipartUploadKeys(String volumeName,
Iterator<Map.Entry<CacheKey<String>, CacheValue<OmBucketInfo>>>
getBucketIterator();
+ Iterator<Map.Entry<CacheKey<String>, CacheValue<OmVolumeArgs>>>
+ getVolumeIterator();
Review Comment:
> Let's reorder the methods so `Volume` comes before `Bucket`. Following the `Volume` -> `Bucket` -> `Key` hierarchy makes the code easier to follow.
Please address this wherever applicable.
--
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-15333. Expose volume quota and namespace usage metrics in OM Prometheus endpoint. [ozone]
Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on PR #11011:
URL: https://github.com/apache/ozone/pull/11011#issuecomment-5405831210
Thanks @sravani-revuri for the patch.
--
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-15333. Expose volume quota and namespace usage metrics in OM Prometheus endpoint. [ozone]
Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on code in PR #11011:
URL: https://github.com/apache/ozone/pull/11011#discussion_r3811392053
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -509,6 +509,7 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl
private final OzoneLockProvider ozoneLockProvider;
private final OMPerformanceMetrics perfMetrics;
private final BucketUtilizationMetrics bucketUtilizationMetrics;
+ private final VolumeUtilizationMetrics volumeUtilizationMetrics;
Review Comment:
Here as well.
--
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-15333. Expose volume quota and namespace usage metrics in OM Prometheus endpoint. [ozone]
Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on code in PR #11011:
URL: https://github.com/apache/ozone/pull/11011#discussion_r3811390294
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -998,6 +998,12 @@ public List<OmBucketInfo> listBuckets(final String volumeName,
return bucketTable.cacheIterator();
}
+ @Override
+ public Iterator<Map.Entry<CacheKey<String>, CacheValue<OmVolumeArgs>>>
+ getVolumeIterator() {
+ return volumeTable.cacheIterator();
+ }
+
Review Comment:
Place this before `getBucketIterator()`.
--
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-15333. Expose volume quota and namespace usage metrics in OM Prometheus endpoint. [ozone]
Posted by "sravani-revuri (via GitHub)" <gi...@apache.org>.
sravani-revuri commented on code in PR #11011:
URL: https://github.com/apache/ozone/pull/11011#discussion_r3811501810
##########
hadoop-ozone/interface-storage/src/main/java/org/apache/hadoop/ozone/om/OMMetadataManager.java:
##########
@@ -588,6 +588,9 @@ List<OmMultipartUpload> getMultipartUploadKeys(String volumeName,
Iterator<Map.Entry<CacheKey<String>, CacheValue<OmBucketInfo>>>
getBucketIterator();
+ Iterator<Map.Entry<CacheKey<String>, CacheValue<OmVolumeArgs>>>
+ getVolumeIterator();
Review Comment:
Thanks for pointing it out again @sarvekshayr. Apologies for missing this initially. Changes have been addressed now.
--
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-15333. Expose volume quota and namespace usage metrics in OM Prometheus endpoint. [ozone]
Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr merged PR #11011:
URL: https://github.com/apache/ozone/pull/11011
--
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-15333. Expose volume quota and namespace usage metrics in OM Prometheus endpoint. [ozone]
Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on code in PR #11011:
URL: https://github.com/apache/ozone/pull/11011#discussion_r3810366444
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/VolumeUtilizationMetrics.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.om;
+
+import java.util.Iterator;
+import java.util.Map.Entry;
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.hdds.utils.db.cache.CacheKey;
+import org.apache.hadoop.hdds.utils.db.cache.CacheValue;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsInfo;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.ozone.OzoneConsts;
+import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs;
+
+/**
+ * A class for collecting and reporting volume utilization metrics.
+ * Available metrics:
Review Comment:
Use `<ul>` and `<li>` tags to list the available metrics.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/BucketUtilizationMetrics.java:
##########
@@ -37,10 +37,10 @@
* Available metrics:
Review Comment:
List all the metrics in the javadoc. Currently missing `BucketUsedNamespace` and `BucketSnapshotUsedBytes`.
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestBucketUtilizationMetrics.java:
##########
@@ -55,15 +55,17 @@ public class TestBucketUtilizationMetrics {
private static final long QUOTA_IN_BYTES_2 = QUOTA_RESET;
private static final long QUOTA_IN_NAMESPACE_1 = 1;
private static final long QUOTA_IN_NAMESPACE_2 = 2;
+ private static final long USED_NAMESPACE_1 = 5;
+ private static final long USED_NAMESPACE_2 = 3;
Review Comment:
If the test values are arbitrary, using sequential numbers (e.g., 1 and 2) would make it easier to add more metrics down the line.
```suggestion
private static final long USED_NAMESPACE_1 = 3;
private static final long USED_NAMESPACE_2 = 4;
```
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestVolumeUtilizationMetrics.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.om;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.hadoop.hdds.utils.db.cache.CacheKey;
+import org.apache.hadoop.hdds.utils.db.cache.CacheValue;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsInfo;
+import org.apache.hadoop.metrics2.MetricsRecordBuilder;
+import org.apache.hadoop.ozone.OzoneConsts;
+import org.apache.hadoop.ozone.om.VolumeUtilizationMetrics.VolumeMetricsInfo;
+import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Test class for VolumeUtilizationMetrics.
+ */
+public class TestVolumeUtilizationMetrics {
+
+ private static final String VOLUME_NAME_1 = "volume1";
+ private static final String VOLUME_NAME_2 = "volume2";
+ private static final long QUOTA_IN_BYTES_1 = OzoneConsts.TB;
+ private static final long QUOTA_IN_BYTES_2 = -1;
+ private static final long QUOTA_IN_NAMESPACE_1 = 10;
+ private static final long QUOTA_IN_NAMESPACE_2 = -1;
+ private static final long USED_NAMESPACE_1 = 4;
+ private static final long USED_NAMESPACE_2 = 0;
Review Comment:
Same comment applies here as well regarding sequential numbers.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/VolumeUtilizationMetrics.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.om;
+
+import java.util.Iterator;
+import java.util.Map.Entry;
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.hdds.utils.db.cache.CacheKey;
+import org.apache.hadoop.hdds.utils.db.cache.CacheValue;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsInfo;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.ozone.OzoneConsts;
+import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs;
+
+/**
+ * A class for collecting and reporting volume utilization metrics.
+ * Available metrics:
+ * Volume quota in bytes.
+ * Volume quota in namespace (maximum number of buckets).
Review Comment:
Add javadoc similar to `BucketUtilizationMetrics` that if volume quota is not set then this metric shows -1 as value.
--
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