You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
fix(semconv): clear pooled slices to enable GC (#8352)
Fixes #8320 Credits to ash2k
This commit is contained in:
@@ -181,6 +181,7 @@ func (m ClientConsumedMessages) Add(
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
clear(*o)
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
@@ -218,6 +219,7 @@ func (m ClientConsumedMessages) AddSet(ctx context.Context, incr int64, set attr
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
clear(*o)
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
@@ -487,6 +489,7 @@ func (m ClientOperationDuration) Record(
|
||||
|
||||
o := recOptPool.Get().(*[]metric.RecordOption)
|
||||
defer func() {
|
||||
clear(*o)
|
||||
*o = (*o)[:0]
|
||||
recOptPool.Put(o)
|
||||
}()
|
||||
@@ -520,6 +523,7 @@ func (m ClientOperationDuration) RecordSet(ctx context.Context, val float64, set
|
||||
|
||||
o := recOptPool.Get().(*[]metric.RecordOption)
|
||||
defer func() {
|
||||
clear(*o)
|
||||
*o = (*o)[:0]
|
||||
recOptPool.Put(o)
|
||||
}()
|
||||
@@ -680,6 +684,7 @@ func (m ClientSentMessages) Add(
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
clear(*o)
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
@@ -713,6 +718,7 @@ func (m ClientSentMessages) AddSet(ctx context.Context, incr int64, set attribut
|
||||
|
||||
o := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
clear(*o)
|
||||
*o = (*o)[:0]
|
||||
addOptPool.Put(o)
|
||||
}()
|
||||
@@ -953,6 +959,7 @@ func (m ProcessDuration) Record(
|
||||
|
||||
o := recOptPool.Get().(*[]metric.RecordOption)
|
||||
defer func() {
|
||||
clear(*o)
|
||||
*o = (*o)[:0]
|
||||
recOptPool.Put(o)
|
||||
}()
|
||||
@@ -986,6 +993,7 @@ func (m ProcessDuration) RecordSet(ctx context.Context, val float64, set attribu
|
||||
|
||||
o := recOptPool.Get().(*[]metric.RecordOption)
|
||||
defer func() {
|
||||
clear(*o)
|
||||
*o = (*o)[:0]
|
||||
recOptPool.Put(o)
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user