pub struct SimpleSpanProcessor<T>where
T: SpanExporter,{ /* private fields */ }
Available on crate feature
telemetry
only.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> SimpleSpanProcessor<T>where
T: SpanExporter,
impl<T> SimpleSpanProcessor<T>where
T: SpanExporter,
Sourcepub fn new(exporter: T) -> SimpleSpanProcessor<T>
pub fn new(exporter: T) -> SimpleSpanProcessor<T>
Create a new SimpleSpanProcessor using the provided exporter.
Trait Implementations§
Source§impl<T> Debug for SimpleSpanProcessor<T>where
T: Debug + SpanExporter,
impl<T> Debug for SimpleSpanProcessor<T>where
T: Debug + SpanExporter,
Source§impl<T> SpanProcessor for SimpleSpanProcessor<T>where
T: SpanExporter,
impl<T> SpanProcessor for SimpleSpanProcessor<T>where
T: SpanExporter,
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 SpanData
Source§fn force_flush(&self) -> Result<(), OTelSdkError>
fn force_flush(&self) -> Result<(), OTelSdkError>
Force the spans lying in the cache to be exported.
Source§fn shutdown(&self) -> Result<(), OTelSdkError>
fn shutdown(&self) -> Result<(), OTelSdkError>
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.
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