mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-02-09 13:37:12 +02:00
Fix #5384 Run of `go test -count=1000000 -run="TestBatchProcessor/DroppedLogs"` **Before**: Failed with either `Condition never satisfied` or panic **After**: Passed First, bytes.Buffer is not thread-safe, so writing log and reading (`bytes.String()`) caused panic. Added `concurrentBuffer` Second, fixed flaky test with 4 records: 1. Record goes to `testExporter.Export` function and blocks in this function because of `ExportTrigger` (19ee6d4775/sdk/log/exporter_test.go (L87)
) 2. Record goes to `bufferExporter.input` (7c5e64cccc/sdk/log/exporter.go (L129)
) 3. Record goes to `BatchProcessor.q` queue and it could not be enqueued to export, because `bufferExporter.input` is full 4. Record goes to `BatchProcessor.q` and because of overfill, drops third record --------- Co-authored-by: Sam Xie <sam@samxie.me>