function SimpleSpanProcessor::flush
3 calls to SimpleSpanProcessor::flush()
- SimpleSpanProcessor::forceFlush in vendor/
open-telemetry/ sdk/ Trace/ SpanProcessor/ SimpleSpanProcessor.php - Export all ended spans to the configured Exporter that have not yet been exported. Returns `true` if the flush was successful, otherwise `false`.
- SimpleSpanProcessor::onEnd in vendor/
open-telemetry/ sdk/ Trace/ SpanProcessor/ SimpleSpanProcessor.php - SimpleSpanProcessor::shutdown in vendor/
open-telemetry/ sdk/ Trace/ SpanProcessor/ SimpleSpanProcessor.php - Cleanup; after shutdown, calling onStart, onEnd, or forceFlush is invalid Returns `false` is the processor is already shutdown, otherwise `true`.
File
-
vendor/
open-telemetry/ sdk/ Trace/ SpanProcessor/ SimpleSpanProcessor.php, line 74
Class
Namespace
OpenTelemetry\SDK\Trace\SpanProcessorCode
private function flush(Closure $task, string $taskName, bool $propagateResult, ContextInterface $context) : bool {
$this->queue
->enqueue([
$task,
$taskName,
$propagateResult && !$this->running,
$context,
]);
if ($this->running) {
return false;
}
$success = true;
$exception = null;
$this->running = true;
try {
while (!$this->queue
->isEmpty()) {
[
$task,
$taskName,
$propagateResult,
$context,
] = $this->queue
->dequeue();
$scope = $context->activate();
try {
$result = $task();
if ($propagateResult) {
$success = $result;
}
} catch (Throwable $e) {
if ($propagateResult) {
$exception = $e;
}
else {
self::logError(sprintf('Unhandled %s error', $taskName), [
'exception' => $e,
]);
}
} finally {
$scope->detach();
}
}
} finally {
$this->running = false;
}
if ($exception !== null) {
throw $exception;
}
return $success;
}