mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
replication: Fix replica stats during crawling (#13499)
Also show replica stats with an ARN in Prometheus output.
This commit is contained in:
parent
29d885b40f
commit
20761e053e
@ -219,20 +219,26 @@ func (e *dataUsageEntry) addSizes(summary sizeSummary) {
|
|||||||
e.Versions += summary.versions
|
e.Versions += summary.versions
|
||||||
e.ObjSizes.add(summary.totalSize)
|
e.ObjSizes.add(summary.totalSize)
|
||||||
|
|
||||||
if summary.replTargetStats != nil {
|
if e.ReplicationStats == nil {
|
||||||
if e.ReplicationStats == nil {
|
e.ReplicationStats = &replicationAllStats{
|
||||||
e.ReplicationStats = &replicationAllStats{Targets: make(map[string]replicationStats)}
|
Targets: make(map[string]replicationStats),
|
||||||
}
|
}
|
||||||
|
} else if e.ReplicationStats.Targets == nil {
|
||||||
|
e.ReplicationStats.Targets = make(map[string]replicationStats)
|
||||||
|
}
|
||||||
|
e.ReplicationStats.ReplicaSize += uint64(summary.replicaSize)
|
||||||
|
|
||||||
|
if summary.replTargetStats != nil {
|
||||||
for arn, st := range summary.replTargetStats {
|
for arn, st := range summary.replTargetStats {
|
||||||
tgtStat, ok := e.ReplicationStats.Targets[arn]
|
tgtStat, ok := e.ReplicationStats.Targets[arn]
|
||||||
if !ok {
|
if !ok {
|
||||||
tgtStat = replicationStats{}
|
tgtStat = replicationStats{}
|
||||||
}
|
}
|
||||||
tgtStat.PendingSize = tgtStat.PendingSize + uint64(st.pendingSize)
|
tgtStat.PendingSize += uint64(st.pendingSize)
|
||||||
tgtStat.FailedSize = tgtStat.FailedSize + uint64(st.failedSize)
|
tgtStat.FailedSize += uint64(st.failedSize)
|
||||||
tgtStat.ReplicatedSize = tgtStat.ReplicatedSize + uint64(st.replicatedSize)
|
tgtStat.ReplicatedSize += uint64(st.replicatedSize)
|
||||||
tgtStat.FailedCount = tgtStat.FailedCount + st.failedCount
|
tgtStat.FailedCount += st.failedCount
|
||||||
tgtStat.PendingCount = tgtStat.PendingCount + st.pendingCount
|
tgtStat.PendingCount += st.pendingCount
|
||||||
e.ReplicationStats.Targets[arn] = tgtStat
|
e.ReplicationStats.Targets[arn] = tgtStat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,21 +249,21 @@ func (e *dataUsageEntry) merge(other dataUsageEntry) {
|
|||||||
e.Objects += other.Objects
|
e.Objects += other.Objects
|
||||||
e.Versions += other.Versions
|
e.Versions += other.Versions
|
||||||
e.Size += other.Size
|
e.Size += other.Size
|
||||||
ors := other.ReplicationStats
|
if other.ReplicationStats != nil {
|
||||||
if ors != nil && len(ors.Targets) > 0 {
|
|
||||||
if e.ReplicationStats == nil {
|
if e.ReplicationStats == nil {
|
||||||
e.ReplicationStats = &replicationAllStats{Targets: make(map[string]replicationStats)}
|
e.ReplicationStats = &replicationAllStats{Targets: make(map[string]replicationStats)}
|
||||||
|
} else if e.ReplicationStats.Targets == nil {
|
||||||
|
e.ReplicationStats.Targets = make(map[string]replicationStats)
|
||||||
}
|
}
|
||||||
if other.ReplicationStats != nil {
|
e.ReplicationStats.ReplicaSize += other.ReplicationStats.ReplicaSize
|
||||||
for arn, stat := range other.ReplicationStats.Targets {
|
for arn, stat := range other.ReplicationStats.Targets {
|
||||||
st := e.ReplicationStats.Targets[arn]
|
st := e.ReplicationStats.Targets[arn]
|
||||||
e.ReplicationStats.Targets[arn] = replicationStats{
|
e.ReplicationStats.Targets[arn] = replicationStats{
|
||||||
PendingSize: stat.PendingSize + st.PendingSize,
|
PendingSize: stat.PendingSize + st.PendingSize,
|
||||||
FailedSize: stat.FailedSize + st.FailedSize,
|
FailedSize: stat.FailedSize + st.FailedSize,
|
||||||
ReplicatedSize: stat.ReplicatedSize + st.ReplicatedSize,
|
ReplicatedSize: stat.ReplicatedSize + st.ReplicatedSize,
|
||||||
PendingCount: stat.PendingCount + st.PendingCount,
|
PendingCount: stat.PendingCount + st.PendingCount,
|
||||||
FailedCount: stat.FailedCount + st.FailedCount,
|
FailedCount: stat.FailedCount + st.FailedCount,
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1459,6 +1459,12 @@ func getBucketUsageMetrics() MetricsGroup {
|
|||||||
VariableLabels: map[string]string{"bucket": bucket},
|
VariableLabels: map[string]string{"bucket": bucket},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
metrics = append(metrics, Metric{
|
||||||
|
Description: getBucketRepReceivedBytesMD(),
|
||||||
|
Value: float64(stats.ReplicaSize),
|
||||||
|
VariableLabels: map[string]string{"bucket": bucket},
|
||||||
|
})
|
||||||
|
|
||||||
if stats.hasReplicationUsage() {
|
if stats.hasReplicationUsage() {
|
||||||
for arn, stat := range stats.Stats {
|
for arn, stat := range stats.Stats {
|
||||||
metrics = append(metrics, Metric{
|
metrics = append(metrics, Metric{
|
||||||
@ -1471,11 +1477,6 @@ func getBucketUsageMetrics() MetricsGroup {
|
|||||||
Value: float64(stat.ReplicatedSize),
|
Value: float64(stat.ReplicatedSize),
|
||||||
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
||||||
})
|
})
|
||||||
metrics = append(metrics, Metric{
|
|
||||||
Description: getBucketRepReceivedBytesMD(),
|
|
||||||
Value: float64(stat.ReplicaSize),
|
|
||||||
VariableLabels: map[string]string{"bucket": bucket, "targetArn": arn},
|
|
||||||
})
|
|
||||||
metrics = append(metrics, Metric{
|
metrics = append(metrics, Metric{
|
||||||
Description: getBucketRepFailedOperationsMD(),
|
Description: getBucketRepFailedOperationsMD(),
|
||||||
Value: float64(stat.FailedCount),
|
Value: float64(stat.FailedCount),
|
||||||
|
@ -456,8 +456,8 @@ func getLatestReplicationStats(bucket string, u BucketUsageInfo) (s BucketReplic
|
|||||||
|
|
||||||
// add initial usage stat to cluster stats
|
// add initial usage stat to cluster stats
|
||||||
usageStat := globalReplicationStats.GetInitialUsage(bucket)
|
usageStat := globalReplicationStats.GetInitialUsage(bucket)
|
||||||
|
totReplicaSize += usageStat.ReplicaSize
|
||||||
if usageStat.Stats != nil {
|
if usageStat.Stats != nil {
|
||||||
totReplicaSize += usageStat.ReplicaSize
|
|
||||||
for arn, stat := range usageStat.Stats {
|
for arn, stat := range usageStat.Stats {
|
||||||
st := stats[arn]
|
st := stats[arn]
|
||||||
if st == nil {
|
if st == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user