Add helper functions for Block volume Capacity detection
Similar to how NewMetricsStatFS() works, the new NewMetricsBlock() provides the GetMetrics() interface for Block volumes. Additional metrics for Block volumes are difficult to gather. There is no guarantee that there is a filesystem on the volume, which makes most of the volume metrics useless. Advanced storage might be able to detect the actual consumption (when thin-provisioned) vs the capacity. However, this is out of the scope for a standard helper function and requires intimate knowledge of the used storage system.
This commit is contained in:
@@ -35,6 +35,14 @@ func NewNotSupportedError() *MetricsError {
|
||||
}
|
||||
}
|
||||
|
||||
// NewNotImplementedError creates a new MetricsError with code NotSupported.
|
||||
func NewNotImplementedError(reason string) *MetricsError {
|
||||
return &MetricsError{
|
||||
Code: ErrCodeNotSupported,
|
||||
Msg: fmt.Sprintf("metrics support is not implemented: %s", reason),
|
||||
}
|
||||
}
|
||||
|
||||
// NewNotSupportedErrorWithDriverName creates a new MetricsError with code NotSupported.
|
||||
// driver name is added to the error message.
|
||||
func NewNotSupportedErrorWithDriverName(name string) *MetricsError {
|
||||
|
Reference in New Issue
Block a user