Skip to content

Commit

Permalink
lock collectors
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveromahony committed Aug 28, 2024
1 parent 3a729e1 commit d473ba2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/plugins/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ func (m *Metrics) Init(pipeline core.MessagePipeInterface) {
}

func (m *Metrics) Close() {
m.collectorsMutex.Lock()
m.collectors = nil
m.collectorsMutex.Unlock()
log.Info("Metrics is wrapping up")
}

Expand Down Expand Up @@ -336,6 +338,8 @@ func createCollectorConfigsMap(config *config.Config, binary core.NginxBinary, p
}

func (m *Metrics) updateCollectorsConfig() {
m.collectorsMutex.Lock()
defer m.collectorsMutex.Unlock()
log.Trace("Updating collector config")
for _, collector := range m.collectors {
if nginxCollector, ok := collector.(*collectors.NginxCollector); ok {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d473ba2

Please sign in to comment.