From 76da26560a18de775354fa10d66b955d3e186ded Mon Sep 17 00:00:00 2001 From: Nikola Grcevski Date: Thu, 9 Jan 2025 16:50:08 -0500 Subject: [PATCH] don't copy bytes in exemplar.Collect --- sdk/metric/exemplar/storage.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/metric/exemplar/storage.go b/sdk/metric/exemplar/storage.go index 0e2e26dfb18..3befa0bfe72 100644 --- a/sdk/metric/exemplar/storage.go +++ b/sdk/metric/exemplar/storage.go @@ -30,7 +30,8 @@ func newStorage(n int) *storage { func (r *storage) Collect(dest *[]Exemplar) { *dest = reset(*dest, len(r.store), len(r.store)) var n int - for _, m := range r.store { + for i := range r.store { + m := &r.store[i] if !m.valid { continue }