From cdd7ad020e165fe680703b6d3319b908b682fb7a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 20 Oct 2023 17:12:29 +0300 Subject: jaeger-client -> opentelemetry --- .../Trace/Behavior/SpanExporterDecoratorTrait.php | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 vendor/open-telemetry/sdk/Trace/Behavior/SpanExporterDecoratorTrait.php (limited to 'vendor/open-telemetry/sdk/Trace/Behavior/SpanExporterDecoratorTrait.php') diff --git a/vendor/open-telemetry/sdk/Trace/Behavior/SpanExporterDecoratorTrait.php b/vendor/open-telemetry/sdk/Trace/Behavior/SpanExporterDecoratorTrait.php new file mode 100644 index 000000000..97839ec5b --- /dev/null +++ b/vendor/open-telemetry/sdk/Trace/Behavior/SpanExporterDecoratorTrait.php @@ -0,0 +1,47 @@ + $batch + * @return FutureInterface + */ + public function export(iterable $batch, ?CancellationInterface $cancellation = null): FutureInterface + { + $batch = $this->beforeExport($batch); + $response = $this->decorated->export($batch, $cancellation); + $response->map(fn (bool $result) => $this->afterExport($batch, $result)); + + return $response; + } + + abstract protected function beforeExport(iterable $spans): iterable; + + abstract protected function afterExport(iterable $spans, bool $exportSuccess): void; + + public function shutdown(?CancellationInterface $cancellation = null): bool + { + return $this->decorated->shutdown($cancellation); + } + + public function forceFlush(?CancellationInterface $cancellation = null): bool + { + return $this->decorated->forceFlush($cancellation); + } + + public function setDecorated(SpanExporterInterface $decorated): void + { + $this->decorated = $decorated; + } +} -- cgit v1.2.3