opentelemetry-php icon indicating copy to clipboard operation
opentelemetry-php copied to clipboard

`SpanProcessor` incorrect calls to `SpanExporter::forceFlush()`

Open Nevay opened this issue 3 years ago • 3 comments

  • SimpleSpanProcessor::forceFlush() has to force-flush exporter
  • BatchSpanProcessor::onEnd() shouldn't force-flush exporter

Nevay avatar Jun 16 '22 11:06 Nevay

I agree with SimpleSpanProcessor::forceFlush(), but the conditional flush in BatchSpanProcessor::onEnd() seems critical to the batching functionality. Is the issue that we're using the forceFlush() mechanism not for its intended purpose?

brettmc avatar Jun 16 '22 11:06 brettmc

The batching functionality doesn't depend on force-flushing; the batch processor should still call ::export() with the batch in ::onEnd(), just without calling ::forceFlush() afterwards.

SpanExporter::forceFlush()

ForceFlush SHOULD only be called in cases where it is absolutely necessary, such as when using some FaaS providers that may suspend the process after an invocation, but before the exporter exports the completed spans.

Nevay avatar Jun 16 '22 12:06 Nevay

I would like to work on this one. Can you please assign it to me. thanks

amber0612 avatar Aug 01 '22 11:08 amber0612

Fixed by #788

brettmc avatar Aug 25 '22 06:08 brettmc