fix: provide a possible slice cap for heal failed metrics items (#17647)

Signed-off-by: Wu <yang.wu@daocloud.io>
This commit is contained in:
drivebyer 2023-07-15 02:02:45 +08:00 committed by GitHub
parent 005a4a275a
commit 04c792476f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1664,8 +1664,9 @@ func getMinioHealingMetrics() *MetricsGroup {
} }
func getFailedItems(seq *healSequence) (m []Metric) { func getFailedItems(seq *healSequence) (m []Metric) {
m = make([]Metric, 0, 1) items := seq.gethealFailedItemsMap()
for k, v := range seq.gethealFailedItemsMap() { m = make([]Metric, 0, len(items))
for k, v := range items {
s := strings.Split(k, ",") s := strings.Split(k, ",")
m = append(m, Metric{ m = append(m, Metric{
Description: getHealObjectsFailTotalMD(), Description: getHealObjectsFailTotalMD(),