1
0
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:
Robert Pająk
2026-05-21 08:00:44 +02:00
committed by GitHub
parent 597532c4d4
commit 4e7ae497e4
22 changed files with 678 additions and 0 deletions
+8
View File
@@ -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)
}()