You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-12-07 23:32:49 +02:00
Create a new recorder rather than reuse one for same labels (#610)
Co-authored-by: Rahul Patel <rahulpa@google.com>
This commit is contained in:
@@ -216,7 +216,13 @@ func (a *asyncInstrument) getRecorder(kvs []core.KeyValue) export.Aggregator {
|
||||
|
||||
lrec, ok := a.recorders[labels.ordered]
|
||||
if ok {
|
||||
lrec.modifiedEpoch = a.meter.currentEpoch
|
||||
if lrec.modifiedEpoch == a.meter.currentEpoch {
|
||||
// last value wins for Observers, so if we see the same labels
|
||||
// in the current epoch, we replace the old recorder
|
||||
lrec.recorder = a.meter.batcher.AggregatorFor(&a.descriptor)
|
||||
} else {
|
||||
lrec.modifiedEpoch = a.meter.currentEpoch
|
||||
}
|
||||
a.recorders[labels.ordered] = lrec
|
||||
return lrec.recorder
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user