Skip to content

Commit

Permalink
return rlock
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Scherba <[email protected]>
  • Loading branch information
miklezzzz committed Jul 10, 2024
1 parent 521f98c commit 7692bec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/metric_storage/vault/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func (c *ConstCounterCollector) Describe(ch chan<- *prometheus.Desc) {
}

func (c *ConstCounterCollector) Collect(ch chan<- prometheus.Metric) {
c.mtx.Lock()
defer c.mtx.Unlock()
c.mtx.RLock()
defer c.mtx.RUnlock()

for _, s := range c.collection {
ch <- prometheus.MustNewConstMetric(c.desc, prometheus.CounterValue, float64(s.Value), s.LabelValues...)
Expand Down Expand Up @@ -199,8 +199,8 @@ func (c *ConstGaugeCollector) Describe(ch chan<- *prometheus.Desc) {
}

func (c *ConstGaugeCollector) Collect(ch chan<- prometheus.Metric) {
c.mtx.Lock()
defer c.mtx.Unlock()
c.mtx.RLock()
defer c.mtx.RUnlock()

for _, s := range c.collection {
ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, s.Value, s.LabelValues...)
Expand Down

0 comments on commit 7692bec

Please sign in to comment.