pub struct SimpleSpanProcessor<T: SpanExporter> { /* private fields */ }Expand description
A SpanProcessor that passes finished spans to the configured
SpanExporter, as soon as they are finished, without any batching. This is
typically useful for debugging and testing. For scenarios requiring higher
performance/throughput, consider using BatchSpanProcessor.
Spans are exported synchronously
in the same thread that emits the log record.
When using this processor with the OTLP Exporter, the following exporter
features are supported:
grpc-tonic: This requires TracerProvider to be created within a tokio runtime. Spans can be emitted from any thread, including tokio runtime threads.reqwest-blocking-client: TracerProvider may be created anywhere, but spans must be emitted from a non-tokio runtime thread.reqwest-client: TracerProvider may be created anywhere, but spans must be emitted from a tokio runtime thread.
Implementations§
Source§impl<T: SpanExporter> SimpleSpanProcessor<T>
impl<T: SpanExporter> SimpleSpanProcessor<T>
Sourcepub fn new(exporter: T) -> Self
pub fn new(exporter: T) -> Self
Create a new SimpleSpanProcessor using the provided exporter.
Trait Implementations§
Source§impl<T: Debug + SpanExporter> Debug for SimpleSpanProcessor<T>
impl<T: Debug + SpanExporter> Debug for SimpleSpanProcessor<T>
Source§impl<T: SpanExporter> SpanProcessor for SimpleSpanProcessor<T>
impl<T: SpanExporter> SpanProcessor for SimpleSpanProcessor<T>
Source§fn on_start(&self, _span: &mut Span, _cx: &Context)
fn on_start(&self, _span: &mut Span, _cx: &Context)
on_start is called when a Span is started. This method is called
synchronously on the thread that started the span, therefore it should
not block or throw exceptions.Source§fn on_end(&self, span: SpanData)
fn on_end(&self, span: SpanData)
on_end is called after a Span is ended (i.e., the end timestamp is
already set). This method is called synchronously within the Span::end
API, therefore it should not block or throw an exception.
TODO - This method should take reference to SpanDataSource§fn force_flush(&self) -> OTelSdkResult
fn force_flush(&self) -> OTelSdkResult
Force the spans lying in the cache to be exported.
Source§fn shutdown_with_timeout(&self, timeout: Duration) -> OTelSdkResult
fn shutdown_with_timeout(&self, timeout: Duration) -> OTelSdkResult
Shuts down the processor. Called when SDK is shut down. This is an
opportunity for processors to do any cleanup required. Read more
Source§fn set_resource(&mut self, resource: &Resource)
fn set_resource(&mut self, resource: &Resource)
Set the resource for the span processor.
Source§fn shutdown(&self) -> OTelSdkResult
fn shutdown(&self) -> OTelSdkResult
shutdown the processor with a default timeout.
Auto Trait Implementations§
impl<T> !Freeze for SimpleSpanProcessor<T>
impl<T> RefUnwindSafe for SimpleSpanProcessor<T>
impl<T> Send for SimpleSpanProcessor<T>
impl<T> Sync for SimpleSpanProcessor<T>
impl<T> Unpin for SimpleSpanProcessor<T>where
T: Unpin,
impl<T> UnwindSafe for SimpleSpanProcessor<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more