HDDS-15333. Expose volume and bucket utilization metrics on OM /prom#10576
Open
prathmesh12-coder wants to merge 2 commits into
Open
HDDS-15333. Expose volume and bucket utilization metrics on OM /prom#10576prathmesh12-coder wants to merge 2 commits into
prathmesh12-coder wants to merge 2 commits into
Conversation
Added VolumeUtilizationMetrics with volume used/available bytes, register them on OM, and expose bucket used namespace.
Contributor
|
@rnblough You may be interested in this as well. |
errose28
reviewed
Jun 22, 2026
Comment on lines
+79
to
+88
| Map<String, Long> usedBytesPerVolume = new HashMap<>(); | ||
| Iterator<Entry<CacheKey<String>, CacheValue<OmBucketInfo>>> bucketIterator = metadataManager.getBucketIterator(); | ||
| while (bucketIterator.hasNext()) { | ||
| Entry<CacheKey<String>, CacheValue<OmBucketInfo>> entry = bucketIterator.next(); | ||
| OmBucketInfo bucketInfo = entry.getValue().getCacheValue(); | ||
| if (bucketInfo == null) { | ||
| continue; | ||
| } | ||
| usedBytesPerVolume.merge(bucketInfo.getVolumeName(), bucketInfo.getUsedBytes(), Long::sum); | ||
| } |
Contributor
There was a problem hiding this comment.
Thanks for adding these metrics. Overall these look like good additions, I just have a concern with the volume used bytes. It is not directly tracked by Ozone because volumes don't have any connection to files, only buckets. Hence the used namespace tracked per volume is just a count of number of buckets and there is no used bytes for volumes.
I think this could be aggregated with promQL outside of Ozone if needed.
cc @sumitagrawl
Author
There was a problem hiding this comment.
Hi @errose28, Thanks for the feedback!
Removed the VolumeUsedBytes and VolumeAvailableBytes metrics along with the aggregation logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR includes OM Prometheus metrics on /prom with volume-level utilization gauges and adds a missing bucket namespace usage gauge.
OM already exposes bucket utilization metrics (bucket_utilization_metrics_*) on /prom, but volume-level used/available byte metrics were not exposed.
Requested improvement:
-> Expose OM Prometheus metrics for below.
-> 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.
Changes made:
Added VolumeUtilizationMetrics — a new MetricsSource registered on OM that publishes, per volume:
Added OMMetadataManager.getVolumeIterator() — mirrors the existing getBucketIterator() API so volume metrics can iterate OM metadata.
Extended BucketUtilizationMetrics — exposed BucketUsedNamespace (number of keys/directories in the bucket), which was previously missing from /prom.
On /prom, these appear as volume_utilization_metrics_* and bucket_utilization_metrics_bucket_used_namespace, following the same normalization as existing bucket utilization metrics.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15333
How was this patch tested?
Unit tests
Manual testing (docker compose cluster)
CI — GitHub Actions
build-branchsucceeded on fork (HDDS-15333): https://github.com/prathmesh12-coder/ozone/actions/runs/27940909061