File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
2222 "net"
2323 "os"
2424 "regexp"
25+ "sync"
2526
2627 "github.com/alecthomas/kingpin/v2"
2728 "github.com/go-kit/log"
@@ -41,6 +42,7 @@ type netClassCollector struct {
4142 subsystem string
4243 ignoredDevicesPattern * regexp.Regexp
4344 metricDescs map [string ]* prometheus.Desc
45+ metricDescsMu sync.Mutex
4446 logger log.Logger
4547}
4648
@@ -136,6 +138,9 @@ func (c *netClassCollector) netClassSysfsUpdate(ch chan<- prometheus.Metric) err
136138}
137139
138140func (c * netClassCollector ) getFieldDesc (name string ) * prometheus.Desc {
141+ c .metricDescsMu .Lock ()
142+ defer c .metricDescsMu .Unlock ()
143+
139144 fieldDesc , exists := c .metricDescs [name ]
140145
141146 if ! exists {
You can’t perform that action at this time.
0 commit comments