mirror of
https://github.com/minio/minio.git
synced 2025-11-22 18:47:43 -05:00
metrics: Use StorageInfo() instead to have consistent info (#9006)
Metrics used to have its own code to calculate offline disks. StorageInfo() was avoided because it is an expensive operation by sending calls to all nodes. To make metrics & server info share the same code, a new argument `local` is added to StorageInfo() so it will only query local disks when needed. Metrics now calls StorageInfo() as server info handler does but with the local flag set to false. Co-authored-by: Praveen raj Mani <praveen@minio.io> Co-authored-by: Harshavardhana <harsha@minio.io>
This commit is contained in:
@@ -131,7 +131,7 @@ func (z *xlZones) getZonesAvailableSpace(ctx context.Context) zonesAvailableSpac
|
||||
for index := range z.zones {
|
||||
index := index
|
||||
g.Go(func() error {
|
||||
storageInfos[index] = z.zones[index].StorageInfo(ctx)
|
||||
storageInfos[index] = z.zones[index].StorageInfo(ctx, false)
|
||||
return nil
|
||||
}, index)
|
||||
}
|
||||
@@ -176,9 +176,9 @@ func (z *xlZones) Shutdown(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (z *xlZones) StorageInfo(ctx context.Context) StorageInfo {
|
||||
func (z *xlZones) StorageInfo(ctx context.Context, local bool) StorageInfo {
|
||||
if z.SingleZone() {
|
||||
return z.zones[0].StorageInfo(ctx)
|
||||
return z.zones[0].StorageInfo(ctx, local)
|
||||
}
|
||||
|
||||
var storageInfo StorageInfo
|
||||
@@ -188,7 +188,7 @@ func (z *xlZones) StorageInfo(ctx context.Context) StorageInfo {
|
||||
for index := range z.zones {
|
||||
index := index
|
||||
g.Go(func() error {
|
||||
storageInfos[index] = z.zones[index].StorageInfo(ctx)
|
||||
storageInfos[index] = z.zones[index].StorageInfo(ctx, local)
|
||||
return nil
|
||||
}, index)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user