open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.11k stars 2.39k forks source link

[pkg/stanza] Prevent data loss due to `LogEmitter`'s buffer #35456

Open andrzej-stencel opened 1 month ago

andrzej-stencel commented 1 month ago

Component(s)

pkg/stanza

Is your feature request related to a problem? Please describe.

This issue is created as a result of discussion in https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/31074.

During an non-graceful shutdown of the collector, logs kept in the LogEmitter's buffer (the batch field) are lost. This is because they are not persisted and are already marked as sent by the File consumer.

Describe the solution you'd like

Remove the buffer in the LogEmitter and make LogEmitter synchronously emit every log/batch of logs received down the collector pipeline.

This will likely introduce a performance impact if implemented without other changes. This should only be done after:

Describe alternatives you've considered

Additional context

See discussion in https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/31074#issuecomment-2360284799 and further comments.

github-actions[bot] commented 1 month ago

Pinging code owners:

andrzej-stencel commented 1 month ago

Removing needs triage label as this was discussed with the code owner.