Closed
Description
Component(s)
testbed
What happened?
Description
Steps to Reproduce
Run cd testbed/testbed/ && while go test -v -count=1 -run=TestGeneratorAndBackend ./...; do :; done
and observe failure after some time.
Expected Result
All produced events (logs, metrics, or traces) are passed to the sender without dropping silently.
Actual Result
Events are dropped silently when the load generator is stopped. Example observed test failure from the steps to reproduce:
=== RUN TestGeneratorAndBackend/OTLP/HTTP-OTLP/HTTP
2024/07/12 14:35:30 Starting mock backend...
2024/07/12 14:35:30 Starting load generator at 1000 items/sec.
2024/07/12 14:35:30 Stopped generator. Sent: 80 traces (982/sec)
mock_backend_test.go:63:
Error Trace: /Users/lahsivjar/Projects/elastic/opentelemetry-collector-contrib/testbed/testbed/mock_backend_test.go:63
Error: Not equal:
expected: 0x50
actual : 0x46
Test: TestGeneratorAndBackend/OTLP/HTTP-OTLP/HTTP
2024/07/12 14:35:30 Stopping mock backend...
2024/07/12 14:35:30 Stopped backend. Received: 70 items (852/sec)
--- FAIL: TestGeneratorAndBackend (0.16s)
--- PASS: TestGeneratorAndBackend/OTLP-OTLP (0.08s)
--- FAIL: TestGeneratorAndBackend/OTLP/HTTP-OTLP/HTTP (0.08s)
FAIL
FAIL github.com/open-telemetry/opentelemetry-collector-contrib/testbed/testbed 0.802s
FAIL
Collector version
Not Applicable
Environment information
Not Applicable
OpenTelemetry Collector configuration
No response
Log output
No response
Additional context
There is a bug in the ProviderSender load generator (ref)
logData, done := ps.Provider.GenerateLogs()
if done {
return nil
}
for {
select {
case <-ps.stopSignal:
return nil
default:
err := logSender.ConsumeLogs(context.Background(), logData)
The generated count is incremented when GenerateLogs()
is called but if the stop signal has been received then the last generated logs will never be consumed and thus just disappear from accounting. I am working on a fix.