mirror of
https://github.com/minio/minio.git
synced 2025-02-03 09:55:59 -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 {
|
mg.RegisterRead(func(_ context.Context) []Metric {
|
||||||
|
var ml []Metric
|
||||||
// common operational metrics for bucket replication and site replication - published
|
// common operational metrics for bucket replication and site replication - published
|
||||||
// at cluster level
|
// at cluster level
|
||||||
|
if globalReplicationStats != nil {
|
||||||
qs := globalReplicationStats.getNodeQueueStatsSummary()
|
qs := globalReplicationStats.getNodeQueueStatsSummary()
|
||||||
activeWorkersCount := Metric{
|
activeWorkersCount := Metric{
|
||||||
Description: getClusterReplActiveWorkersCountMD(),
|
Description: getClusterReplActiveWorkersCountMD(),
|
||||||
@ -2162,7 +2164,7 @@ func getReplicationClusterMetrics() *MetricsGroup {
|
|||||||
avgTransferRate.Value = tots.Avg
|
avgTransferRate.Value = tots.Avg
|
||||||
maxTransferRate.Value = tots.Peak
|
maxTransferRate.Value = tots.Peak
|
||||||
}
|
}
|
||||||
ml := []Metric{
|
ml = []Metric{
|
||||||
activeWorkersCount,
|
activeWorkersCount,
|
||||||
avgActiveWorkersCount,
|
avgActiveWorkersCount,
|
||||||
maxActiveWorkersCount,
|
maxActiveWorkersCount,
|
||||||
@ -2177,7 +2179,7 @@ func getReplicationClusterMetrics() *MetricsGroup {
|
|||||||
maxTransferRate,
|
maxTransferRate,
|
||||||
mrfCount,
|
mrfCount,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for ep, health := range globalBucketTargetSys.healthStats() {
|
for ep, health := range globalBucketTargetSys.healthStats() {
|
||||||
// link latency current
|
// link latency current
|
||||||
m := Metric{
|
m := Metric{
|
||||||
@ -3019,7 +3021,10 @@ func getBucketUsageMetrics() *MetricsGroup {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
if !globalSiteReplicationSys.isEnabled() {
|
if !globalSiteReplicationSys.isEnabled() {
|
||||||
stats := bucketReplStats[bucket].ReplicationStats
|
var stats BucketReplicationStats
|
||||||
|
s, ok := bucketReplStats[bucket]
|
||||||
|
if ok {
|
||||||
|
stats = s.ReplicationStats
|
||||||
metrics = append(metrics, Metric{
|
metrics = append(metrics, Metric{
|
||||||
Description: getRepReceivedBytesMD(bucketMetricNamespace),
|
Description: getRepReceivedBytesMD(bucketMetricNamespace),
|
||||||
Value: float64(stats.ReplicaSize),
|
Value: float64(stats.ReplicaSize),
|
||||||
@ -3030,6 +3035,7 @@ func getBucketUsageMetrics() *MetricsGroup {
|
|||||||
Value: float64(stats.ReplicaCount),
|
Value: float64(stats.ReplicaCount),
|
||||||
VariableLabels: map[string]string{"bucket": bucket},
|
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{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user