[][src]Struct opentracingrust::utils::ReporterThread

pub struct ReporterThread { /* fields omitted */ }

A basic span reporter backed by a background thread.

The reporter spawns a thread that loops until stopped and waits for FinishedSpans. 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:

  1. The calling thread is paused for the stop_delay duration. This allows the reporter thread to process any FinishedSpans still in the channel.
  2. The background thread is informend to shutdown and the calling thread joins it.
  3. 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]

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]

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,