[−][src]Struct opentracingrust::utils::ReporterThread
A basic span reporter backed by a background thread.
The reporter spawns a thread that loops until stopped and waits for FinishedSpan
s.
Every time a finished span is received the ReporterFn
closure is called with it.
The ReporterFn
closure is responsible for shipping the received spans.
The ReporterThread
also supports clean shutdown of the receiver thread.
When ReporterThread::stop
is called or an instance is dropped:
- The calling thread is paused for the
stop_delay
duration. This allows the reporter thread to process anyFinishedSpan
s still in the channel. - The background thread is informend to shutdown and the calling thread joins it.
- As soon as any
FinishedSpan
is processed or receiving times out the thread is stopped. Receiving spans times out every 50 milliseconds.
Methods
impl ReporterThread
[src]
pub fn new<ReporterFn>(
receiver: SpanReceiver,
reporter: ReporterFn
) -> ReporterThread where
ReporterFn: FnMut(FinishedSpan) + Send + 'static,
[src]
receiver: SpanReceiver,
reporter: ReporterFn
) -> ReporterThread where
ReporterFn: FnMut(FinishedSpan) + Send + 'static,
Creates a new reporter waiting for spans on the receiver
.
The reporter starts with a spawned thread and runs until stopped or dropped.
pub fn new_with_duration<ReporterFn>(
receiver: SpanReceiver,
stop_delay: Duration,
reporter: ReporterFn
) -> ReporterThread where
ReporterFn: FnMut(FinishedSpan) + Send + 'static,
[src]
receiver: SpanReceiver,
stop_delay: Duration,
reporter: ReporterFn
) -> ReporterThread where
ReporterFn: FnMut(FinishedSpan) + Send + 'static,
Version of new
that also sets the stop_delay
.
pub fn stop_delay(&mut self, stop_delay: Duration)
[src]
Updates the stop_delay
for when the thread is stopped.
pub fn stop(&mut self)
[src]
Stops the background thread and joins it.
Trait Implementations
impl Drop for ReporterThread
[src]
Auto Trait Implementations
impl Sync for ReporterThread
impl Unpin for ReporterThread
impl Send for ReporterThread
impl !RefUnwindSafe for ReporterThread
impl !UnwindSafe for ReporterThread
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,