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.
The OTLP HTTP exporter chooses its default HTTP client from enabled crate
features. That choice is not processor-aware. If you enable async HTTP
clients such as reqwest-client or hyper-client, ensure this processor is
only used from a thread where those clients can run.
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. Read more