1
0
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:
ET
2020-04-02 16:51:37 -07:00
committed by GitHub
parent 0f771bba67
commit 367635b740
2 changed files with 12 additions and 6 deletions

View File

@@ -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
}