1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-12-13 23:57:10 +02:00

Change the Reader.Collect Signature. (#3732)

* Changes the signature of Collect().

This DOES NOT make the SDK reuse memory, but it does enable it to be added.
This commit is contained in:
Aaron Clawson
2023-02-21 09:04:27 -06:00
committed by GitHub
parent ecf0838245
commit cc8bdaaad4
9 changed files with 82 additions and 44 deletions

View File

@@ -93,7 +93,7 @@ func BenchmarkCounterCollectOneAttr(b *testing.B) {
for i := 0; i < b.N; i++ {
cntr.Add(ctx, 1, attribute.Int("K", 1))
_, _ = rdr.Collect(ctx)
_ = rdr.Collect(ctx, nil)
}
}
@@ -104,7 +104,7 @@ func BenchmarkCounterCollectTenAttrs(b *testing.B) {
for j := 0; j < 10; j++ {
cntr.Add(ctx, 1, attribute.Int("K", j))
}
_, _ = rdr.Collect(ctx)
_ = rdr.Collect(ctx, nil)
}
}
@@ -140,7 +140,7 @@ func benchCollectHistograms(count int) func(*testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
collectedMetrics, _ = r.Collect(ctx)
_ = r.Collect(ctx, &collectedMetrics)
if len(collectedMetrics.ScopeMetrics[0].Metrics) != count {
b.Fatalf("got %d metrics, want %d", len(collectedMetrics.ScopeMetrics[0].Metrics), count)
}