diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index 67c2243ced0..152ef383ad7 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -348,3 +348,33 @@ func TestSpanDataNilResource(t *testing.T) { }.Snapshots()) }) } + +func BenchmarkSpans(b *testing.B) { + records := []tracesdk.ReadOnlySpan{ + tracetest.SpanStub{ + Attributes: []attribute.KeyValue{ + attribute.String("a", "b"), + attribute.String("b", "b"), + attribute.String("c", "b"), + attribute.String("d", "b"), + }, + Links: []tracesdk.Link{ + {}, + {}, + {}, + {}, + {}, + }, + }.Snapshot(), + } + + b.ResetTimer() + b.ReportAllocs() + b.RunParallel(func(pb *testing.PB) { + var out []*tracepb.ResourceSpans + for pb.Next() { + out = Spans(records) + } + _ = out + }) +}