mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
feat: maintain in-memory tier stats for the last 24hrs (#13782)
This commit is contained in:
committed by
GitHub
parent
f4e373e0d2
commit
d2e5f01542
@@ -1630,3 +1630,31 @@ func (sys *NotificationSys) ReloadSiteReplicationConfig(ctx context.Context) []e
|
||||
wg.Wait()
|
||||
return errs
|
||||
}
|
||||
|
||||
// GetLastDayTierStats fetches per-tier stats of the last 24hrs from all peers
|
||||
func (sys *NotificationSys) GetLastDayTierStats(ctx context.Context) dailyAllTierStats {
|
||||
errs := make([]error, len(sys.allPeerClients))
|
||||
lastDayStats := make([]dailyAllTierStats, len(sys.allPeerClients))
|
||||
var wg sync.WaitGroup
|
||||
for index := range sys.peerClients {
|
||||
if sys.peerClients[index] == nil {
|
||||
continue
|
||||
}
|
||||
wg.Add(1)
|
||||
go func(index int) {
|
||||
defer wg.Done()
|
||||
lastDayStats[index], errs[index] = sys.peerClients[index].GetLastDayTierStats(ctx)
|
||||
}(index)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
merged := globalTransitionState.getDailyAllTierStats()
|
||||
for i, stat := range lastDayStats {
|
||||
if errs[i] != nil {
|
||||
logger.LogIf(ctx, fmt.Errorf("failed to fetch last day tier stats: %w", errs[i]))
|
||||
continue
|
||||
}
|
||||
merged.merge(stat)
|
||||
}
|
||||
return merged
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user