diff --git a/doc.go b/doc.go index 441c595014d..921f85961ad 100644 --- a/doc.go +++ b/doc.go @@ -17,6 +17,8 @@ To read more about tracing, see go.opentelemetry.io/otel/trace. To read more about metrics, see go.opentelemetry.io/otel/metric. +To read more about logs, see go.opentelemetry.io/otel/log. + To read more about propagation, see go.opentelemetry.io/otel/propagation and go.opentelemetry.io/otel/baggage. */ diff --git a/sdk/trace/batch_span_processor_test.go b/sdk/trace/batch_span_processor_test.go index d0720ff5de9..51fdd6b65db 100644 --- a/sdk/trace/batch_span_processor_test.go +++ b/sdk/trace/batch_span_processor_test.go @@ -627,23 +627,32 @@ func TestBatchSpanProcessorConcurrentSafe(t *testing.T) { wg.Wait() } -func BenchmarkSpanProcessor(b *testing.B) { - tp := sdktrace.NewTracerProvider( - sdktrace.WithBatcher( - tracetest.NewNoopExporter(), - sdktrace.WithMaxExportBatchSize(10), - )) - tracer := tp.Tracer("bench") - ctx := context.Background() - - b.ResetTimer() - b.ReportAllocs() - - for i := 0; i < b.N; i++ { - for j := 0; j < 10; j++ { - _, span := tracer.Start(ctx, "bench") - span.End() - } +func BenchmarkSpanProcessorOnEnd(b *testing.B) { + for _, bb := range []struct { + batchSize int + spansCount int + }{ + {batchSize: 10, spansCount: 10}, + {batchSize: 10, spansCount: 100}, + {batchSize: 100, spansCount: 10}, + {batchSize: 100, spansCount: 100}, + } { + b.Run(fmt.Sprintf("batch: %d, spans: %d", bb.batchSize, bb.spansCount), func(b *testing.B) { + bsp := sdktrace.NewBatchSpanProcessor( + tracetest.NewNoopExporter(), + sdktrace.WithMaxExportBatchSize(bb.batchSize), + ) + snap := tracetest.SpanStub{}.Snapshot() + + b.ResetTimer() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + // Ensure the export happens for every run + for j := 0; j < bb.spansCount; j++ { + bsp.OnEnd(snap) + } + } + }) } }