prathmesh12-coder opened a new pull request, #10576:
URL: https://github.com/apache/ozone/pull/10576

   
   ## 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.
   * 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.
   
   Changes made:
   1. Added VolumeUtilizationMetrics — a new MetricsSource registered on OM 
that publishes, per volume:
       * VolumeQuotaBytes — byte quota (-1 if unlimited)
       * VolumeUsedBytes — sum of usedBytes across all buckets in the volume
       * VolumeAvailableBytes — quota - used when a byte quota is set, 
otherwise -1
       * VolumeQuotaNamespace — existing namespace quota
       * VolumeUsedNamespace —  existing namespace usage

       
   2. Added OMMetadataManager.getVolumeIterator() — mirrors the existing 
getBucketIterator() API so volume metrics can iterate OM metadata.

   
   3. Extended BucketUtilizationMetrics — exposed BucketUsedNamespace (number 
of keys/directories in the bucket), which was previously missing from /prom. 

   
   4. 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
       * TestVolumeUtilizationMetrics — verifies volume quota, used bytes, 
available bytes, and namespace gauges.
       * TestBucketUtilizationMetrics — updated to cover BucketUsedNamespace.

       
   * Manual testing (docker compose cluster)
       * Verified metrics on OM /prom:

       ```
       curl -s http://localhost:9874/prom | grep volume_utilization_metrics

       curl -s http://localhost:9874/prom | grep 
bucket_utilization_metrics_bucket_used_namespace
       ```
       * Confirmed volume_utilization_metrics_volume_used_bytes increases after 
writes and volume_utilization_metrics_volume_available_bytes reflects quota 
minus usage.

       
   * CI — GitHub Actions `build-branch` succeeded on fork (HDDS-15333): 
https://github.com/prathmesh12-coder/ozone/actions/runs/27940909061
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to