1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-28 21:09:17 +02:00
opentelemetry-go/sdk
Anton Manakin 982e96dd9b
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`
(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>
2024-05-29 11:19:57 -07:00
..
instrumentation Add READMEs to every package (#5103) 2024-03-26 20:13:54 +01:00
internal docs: update variable name in documentation (#5270) 2024-04-26 15:01:19 -07:00
log sdk/log: Fix TestBatchProcessor/DroppedLogs flaky test (#5421) 2024-05-29 11:19:57 -07:00
metric fix(deps): update module github.com/go-logr/logr to v1.4.2 (#5393) 2024-05-21 13:58:14 -07:00
resource Update all semconv use to v1.25.0 (#5374) 2024-05-19 07:16:33 +02:00
trace Update all semconv use to v1.25.0 (#5374) 2024-05-19 07:16:33 +02:00
go.mod fix(deps): update module github.com/go-logr/logr to v1.4.2 (#5393) 2024-05-21 13:58:14 -07:00
go.sum fix(deps): update module github.com/go-logr/logr to v1.4.2 (#5393) 2024-05-21 13:58:14 -07:00
README.md Add READMEs to every package (#5103) 2024-03-26 20:13:54 +01:00
version_test.go [chore] Simplify the license header (#4987) 2024-02-29 07:05:28 +01:00
version.go Release v1.27.0/v0.49.0/v0.3.0 (#5392) 2024-05-21 10:59:36 -07:00

SDK

PkgGoDev