Skip to content

Commit

Permalink
Only init queueLatency observer once to avoid data race
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamas Molnar committed Sep 17, 2018
1 parent 1d26dfd commit 2c6f357
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ type logProcessor struct {
var queueLatency prometheus.Observer

func NewLogProcessor(forwarder Forwarder, cache Cache, config appConfig) LogProcessor {
queueLatency = registerHistogram("queue_latency", "Post queue latency", []float64{.00001, .000015, .00002, .000025, .00003, .00004, .00005, .00006})
if queueLatency != nil {
queueLatency = registerHistogram("queue_latency", "Post queue latency", []float64{.00001, .000015, .00002, .000025, .00003, .00004, .00005, .00006})
}
return &logProcessor{forwarder: forwarder, cache: cache, wg: sync.WaitGroup{}, chanBuffer: config.chanBuffer, workers: config.workers}
}

Expand Down

0 comments on commit 2c6f357

Please sign in to comment.