mirror of
https://github.com/minio/minio.git
synced 2025-01-24 13:13:16 -05:00
metrics: fix panic in replication stats reporting (#17979)
This commit is contained in:
parent
19f70dbfbf
commit
812f5a02d7
@ -2085,8 +2085,10 @@ func getReplicationClusterMetrics() *MetricsGroup {
|
||||
)
|
||||
|
||||
mg.RegisterRead(func(_ context.Context) []Metric {
|
||||
var ml []Metric
|
||||
// common operational metrics for bucket replication and site replication - published
|
||||
// at cluster level
|
||||
if globalReplicationStats != nil {
|
||||
qs := globalReplicationStats.getNodeQueueStatsSummary()
|
||||
activeWorkersCount := Metric{
|
||||
Description: getClusterReplActiveWorkersCountMD(),
|
||||
@ -2162,7 +2164,7 @@ func getReplicationClusterMetrics() *MetricsGroup {
|
||||
avgTransferRate.Value = tots.Avg
|
||||
maxTransferRate.Value = tots.Peak
|
||||
}
|
||||
ml := []Metric{
|
||||
ml = []Metric{
|
||||
activeWorkersCount,
|
||||
avgActiveWorkersCount,
|
||||
maxActiveWorkersCount,
|
||||
@ -2177,7 +2179,7 @@ func getReplicationClusterMetrics() *MetricsGroup {
|
||||
maxTransferRate,
|
||||
mrfCount,
|
||||
}
|
||||
|
||||
}
|
||||
for ep, health := range globalBucketTargetSys.healthStats() {
|
||||
// link latency current
|
||||
m := Metric{
|
||||
@ -3019,7 +3021,10 @@ func getBucketUsageMetrics() *MetricsGroup {
|
||||
})
|
||||
}
|
||||
if !globalSiteReplicationSys.isEnabled() {
|
||||
stats := bucketReplStats[bucket].ReplicationStats
|
||||
var stats BucketReplicationStats
|
||||
s, ok := bucketReplStats[bucket]
|
||||
if ok {
|
||||
stats = s.ReplicationStats
|
||||
metrics = append(metrics, Metric{
|
||||
Description: getRepReceivedBytesMD(bucketMetricNamespace),
|
||||
Value: float64(stats.ReplicaSize),
|
||||
@ -3030,6 +3035,7 @@ func getBucketUsageMetrics() *MetricsGroup {
|
||||
Value: float64(stats.ReplicaCount),
|
||||
VariableLabels: map[string]string{"bucket": bucket},
|
||||
})
|
||||
}
|
||||
if stats.hasReplicationUsage() {
|
||||
for arn, stat := range stats.Stats {
|
||||
metrics = append(metrics, Metric{
|
||||
|
Loading…
x
Reference in New Issue
Block a user