mirror of
https://github.com/minio/minio.git
synced 2024-12-25 22:55:54 -05:00
avoid replication stats crash in Prometheus
This commit is contained in:
parent
d4bca00df9
commit
d89f6af6c4
@ -270,6 +270,13 @@ func (r *ReplicationStats) getAllLatest(bucketsUsage map[string]BucketUsageInfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *ReplicationStats) calculateBucketReplicationStats(bucket string, u BucketUsageInfo, bucketStats []BucketStats) (s BucketReplicationStats) {
|
func (r *ReplicationStats) calculateBucketReplicationStats(bucket string, u BucketUsageInfo, bucketStats []BucketStats) (s BucketReplicationStats) {
|
||||||
|
if r == nil {
|
||||||
|
s = BucketReplicationStats{
|
||||||
|
Stats: make(map[string]*BucketReplicationStat),
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
// accumulate cluster bucket stats
|
// accumulate cluster bucket stats
|
||||||
stats := make(map[string]*BucketReplicationStat)
|
stats := make(map[string]*BucketReplicationStat)
|
||||||
var totReplicaSize int64
|
var totReplicaSize int64
|
||||||
|
@ -66,7 +66,7 @@ type BucketStats struct {
|
|||||||
// BucketReplicationStats represents inline replication statistics
|
// BucketReplicationStats represents inline replication statistics
|
||||||
// such as pending, failed and completed bytes in total for a bucket
|
// such as pending, failed and completed bytes in total for a bucket
|
||||||
type BucketReplicationStats struct {
|
type BucketReplicationStats struct {
|
||||||
Stats map[string]*BucketReplicationStat
|
Stats map[string]*BucketReplicationStat `json:",omitempty"`
|
||||||
// Pending size in bytes
|
// Pending size in bytes
|
||||||
PendingSize int64 `json:"pendingReplicationSize"`
|
PendingSize int64 `json:"pendingReplicationSize"`
|
||||||
// Completed size in bytes
|
// Completed size in bytes
|
||||||
|
Loading…
Reference in New Issue
Block a user