Skip to content

Commit ef18a11

Browse files
authored
[fix] Add copy of label to prevent errors (#745)
Signed-off-by: Sinelnikov Michail <mikhail.sinelnikov@flant.com>
1 parent 45fa325 commit ef18a11

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/module_manager/go_hook/metrics/collector.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package metrics
22

33
import (
4+
"maps"
5+
46
"github.com/deckhouse/deckhouse/pkg/metrics-storage/operation"
57
sdkpkg "github.com/deckhouse/module-sdk/pkg"
68
pointer "k8s.io/utils/ptr"
@@ -37,7 +39,7 @@ func (dms *MemoryMetricsCollector) Add(name string, value float64, labels map[st
3739
Group: options.group,
3840
Action: operation.ActionCounterAdd,
3941
Value: pointer.To(value),
40-
Labels: labels,
42+
Labels: maps.Clone(labels),
4143
})
4244
}
4345

@@ -54,7 +56,7 @@ func (dms *MemoryMetricsCollector) Set(name string, value float64, labels map[st
5456
Group: options.group,
5557
Action: operation.ActionGaugeSet,
5658
Value: pointer.To(value),
57-
Labels: labels,
59+
Labels: maps.Clone(labels),
5860
})
5961
}
6062

0 commit comments

Comments
 (0)