Skip to content

Commit

Permalink
Add comment why histogram might already exists in metricsprocessor (#250
Browse files Browse the repository at this point in the history
)
  • Loading branch information
krdln authored Aug 30, 2022
1 parent 7ac6103 commit 3369dac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/otelcollector/metricsprocessor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ func (p *metricsProcessor) registerRequestLatencyHistogram() error {
err := p.cfg.promRegistry.Register(p.workloadLatencyHistogram)
if err != nil {
if are, ok := err.(prometheus.AlreadyRegisteredError); ok {
// A histogram for that metric has been registered before. Use the old histogram from now on.
// We're registering this histogram vec from multiple processors
// (logs processor and traces processor), so if both processors are
// enabled, it's expected that whichever processor is created
// second, it will see that the histogram vec was already
// registered. Use the existing histogram vec from now on.
p.workloadLatencyHistogram = are.ExistingCollector.(*prometheus.HistogramVec)
return nil
}
Expand Down

0 comments on commit 3369dac

Please sign in to comment.