Struct SimpleSpanProcessor
pub struct SimpleSpanProcessor<T>where
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§
§impl<T> SimpleSpanProcessor<T>where
T: SpanExporter,
impl<T> SimpleSpanProcessor<T>where
T: SpanExporter,
pub fn new(exporter: T) -> SimpleSpanProcessor<T>
pub fn new(exporter: T) -> SimpleSpanProcessor<T>
Create a new SimpleSpanProcessor using the provided exporter.
Trait Implementations§
§impl<T> Debug for SimpleSpanProcessor<T>where
T: Debug + SpanExporter,
impl<T> Debug for SimpleSpanProcessor<T>where
T: Debug + SpanExporter,
§impl<T> SpanProcessor for SimpleSpanProcessor<T>where
T: SpanExporter,
impl<T> SpanProcessor for SimpleSpanProcessor<T>where
T: SpanExporter,
§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.§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
§fn force_flush(&self) -> Result<(), OTelSdkError>
fn force_flush(&self) -> Result<(), OTelSdkError>
Force the spans lying in the cache to be exported.
§fn shutdown_with_timeout(&self, timeout: Duration) -> Result<(), OTelSdkError>
fn shutdown_with_timeout(&self, timeout: Duration) -> 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
§fn set_resource(&mut self, resource: &Resource)
fn set_resource(&mut self, resource: &Resource)
Set the resource for the span processor.
§fn shutdown(&self) -> Result<(), OTelSdkError>
fn shutdown(&self) -> Result<(), OTelSdkError>
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Create a new
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more