I am unclear why concurrency responsibility for ForceFlush and Shutdown is assigned to LogRecordExporter.
In the standard SDK pipeline, exporter methods are invoked by processors rather than instrumentation code. The specification also says that minimizing the implementation burden for protocol exporters is a goal.
|
The goal of the interface is to minimize burden of implementation for |
|
protocol-dependent telemetry exporters. The protocol exporter is expected to be |
|
primarily a simple telemetry data encoder and transmitter. |
In #4173, we placed responsibility for serializing Export on the built-in processors because restrictions on custom exporter implementations are difficult to enforce. Could the same model apply to all exporter methods?
Concretely, the specification could allow processors to serialize all calls to a given exporter instance (Export, ForceFlush, and Shutdown) and define whether sharing one exporter instance between processors is supported. Sharing already requires cross-processor coordination because Export is not expected to be invoked concurrently.
The OTel Go BatchProcessor now uses one worker for every exporter call and explicitly guarantees no overlap. The single-worker redesign also improved batch benchmarks (although those gains came from the broader removal of polling, buffering, and batch copying rather than serialization alone). The OTel Go SimpleProcessor would need corresponding lifecycle synchronization if responsibility were moved entirely to processors.
Since the same requirement exists for span and metric exporters, this likely needs a cross-signal decision. Could someone explain the use case requiring exporter implementations themselves, rather than their SDK callers, to provide lifecycle concurrency safety? It would also help to define which combinations of Export, ForceFlush, and Shutdown are intended to overlap, if any.
Originally posted by @pellared in #4885
I am unclear why concurrency responsibility for
ForceFlushandShutdownis assigned toLogRecordExporter.In the standard SDK pipeline, exporter methods are invoked by processors rather than instrumentation code. The specification also says that minimizing the implementation burden for protocol exporters is a goal.
opentelemetry-specification/specification/logs/sdk.md
Lines 604 to 606 in b2180c6
In #4173, we placed responsibility for serializing Export on the built-in processors because restrictions on custom exporter implementations are difficult to enforce. Could the same model apply to all exporter methods?
Concretely, the specification could allow processors to serialize all calls to a given exporter instance (
Export,ForceFlush, andShutdown) and define whether sharing one exporter instance between processors is supported. Sharing already requires cross-processor coordination becauseExportis not expected to be invoked concurrently.The OTel Go
BatchProcessornow uses one worker for every exporter call and explicitly guarantees no overlap. The single-worker redesign also improved batch benchmarks (although those gains came from the broader removal of polling, buffering, and batch copying rather than serialization alone). The OTel GoSimpleProcessorwould need corresponding lifecycle synchronization if responsibility were moved entirely to processors.Since the same requirement exists for span and metric exporters, this likely needs a cross-signal decision. Could someone explain the use case requiring exporter implementations themselves, rather than their SDK callers, to provide lifecycle concurrency safety? It would also help to define which combinations of
Export,ForceFlush, andShutdownare intended to overlap, if any.Originally posted by @pellared in #4885