go-ceph
go-ceph copied to clipboard
Enhance `GetPoolStats()` Method to Include `Num_bytes_available` Field in `PoolStat`
Description
Currently, the "github.com/ceph/go-ceph/rados" Go library provides a convenient way to interact with Ceph, including retrieving pool statistics using the GetPoolStats method. However, the Num_bytes_available field is missing in the retrieved pool statistics.
In the current PoolStat struct, there is a Num_bytes field that represents the space used in bytes, but there is no corresponding field representing the available space (Num_bytes_available).
This feature request proposes the addition of support for the Num_bytes_available field in the PoolStat struct and the corresponding GetPoolStats method. Including the Num_bytes_available field is important for users who want to have comprehensive insights into the pool's status, including both used and available capacity.
Proposed Changes
- Modify the Ceph C library to include support for retrieving the
Num_bytes_availablefield in pool statistics. - Update the Go bindings in "github.com/ceph/go-ceph/rados" to expose this new functionality to Go code by extending the
PoolStatstruct to include aNum_bytes_availablefield. - Ensure comprehensive testing to verify the correct retrieval of the
Num_bytes_availablefield. - Update the documentation to include information about how to use the new
Num_bytes_availablefunctionality.
Use Case
The addition of the Num_bytes_available field will benefit users who need to monitor and manage Ceph pools, especially when making decisions based on available capacity.
Community Impact
This enhancement will improve the completeness and usability of the "github.com/ceph/go-ceph" library and benefit the broader Ceph community.
Additional Information
Current PoolStat struct definition:
type PoolStat struct {
// space used in bytes
Num_bytes uint64
// space used in KB
Num_kb uint64
// number of objects in the pool
Num_objects uint64
// number of clones of objects
Num_object_clones uint64
// num_objects * num_replicas
Num_object_copies uint64
Num_objects_missing_on_primary uint64
// number of objects found on no OSDs
Num_objects_unfound uint64
// number of objects replicated fewer times than they should be
// (but found on at least one OSD)
Num_objects_degraded uint64
Num_rd uint64
Num_rd_kb uint64
Num_wr uint64
Num_wr_kb uint64
}
Thanks for the request, I agree that this would probably be a useful enhancement.
- Modify the Ceph C library to include support for retrieving the
Num_bytes_availablefield in pool statistics.
This step is a prerequisite to having the field available in Go. If you haven't already please file a ceph tracker issue (https://tracker.ceph.com) for this. Then link that tracker here so we all can monitor it. Once the field is available in Ceph, then we can look into adding it in go-ceph.
If you haven't already please file a ceph tracker issue (https://tracker.ceph.com) for this. Then link that tracker here so we all can monitor it.
Done. I've created a Ceph tracker issue here to add the Num_bytes_available field in the Ceph C library.