Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sdk/log: Fix TestBatchProcessor/DroppedLogs flaky test (#5421)
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` (https://github.com/open-telemetry/opentelemetry-go/blob/19ee6d4775d578357e251828215213782eafed54/sdk/log/exporter_test.go#L87) 2. Record goes to `bufferExporter.input` (https://github.com/open-telemetry/opentelemetry-go/blob/7c5e64cccc16710b2e75f3d60e96acc07dacd7a7/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>
- Loading branch information