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
+4
View File
@@ -129,6 +129,7 @@ func (m CosmosDBClientActiveInstanceCount) Add(
o := addOptPool.Get().(*[]metric.AddOption)
defer func() {
clear(*o)
*o = (*o)[:0]
addOptPool.Put(o)
}()
@@ -155,6 +156,7 @@ func (m CosmosDBClientActiveInstanceCount) AddSet(ctx context.Context, incr int6
o := addOptPool.Get().(*[]metric.AddOption)
defer func() {
clear(*o)
*o = (*o)[:0]
addOptPool.Put(o)
}()
@@ -332,6 +334,7 @@ func (m CosmosDBClientOperationRequestCharge) Record(
o := recOptPool.Get().(*[]metric.RecordOption)
defer func() {
clear(*o)
*o = (*o)[:0]
recOptPool.Put(o)
}()
@@ -361,6 +364,7 @@ func (m CosmosDBClientOperationRequestCharge) RecordSet(ctx context.Context, val
o := recOptPool.Get().(*[]metric.RecordOption)
defer func() {
clear(*o)
*o = (*o)[:0]
recOptPool.Put(o)
}()