[][src]Struct zipkin::OpenSpan

pub struct OpenSpan<T> { /* fields omitted */ }

An open span.

This is a guard object - the span will be finished and reported when it falls out of scope.

Spans can either be "attached" to or "detached" from their tracer. An attached span manages the thread's current span - it acts like a CurrentGuard. A detached span does not but is Send unlike an attached span. Spans are attached by default, but can be detached or reattached via the detach and attach methods.

Detached spans are intended for use when you need to manually maintain the current trace context. For example, when working with nonblocking futures a single OS thread is managing many separate tasks. The bind method binds a span to a future, setting the thread's current span each time the thread is polled. If some computation starts executing on one thread and finishes executing on another, you can detach the span, send it to the other thread, and then reattach it to properly model that behavior.

Methods

impl<T> OpenSpan<T>[src]

pub fn context(&self) -> TraceContext[src]

Returns the context associated with this span.

pub fn name(&mut self, name: &str)[src]

Sets the name of this span.

pub fn with_name(self, name: &str) -> OpenSpan<T>[src]

A builder-style version of name.

pub fn kind(&mut self, kind: Kind)[src]

Sets the kind of this span.

pub fn with_kind(self, kind: Kind) -> OpenSpan<T>[src]

A builder-style version of kind.

pub fn remote_endpoint(&mut self, remote_endpoint: Endpoint)[src]

Sets the remote endpoint of this span.

pub fn with_remote_endpoint(self, remote_endpoint: Endpoint) -> OpenSpan<T>[src]

A builder-style version of remote_endpoint.

pub fn annotate(&mut self, value: &str)[src]

Attaches an annotation to this span.

pub fn with_annotation(self, value: &str) -> OpenSpan<T>[src]

A builder-style version of annotate.

pub fn tag(&mut self, key: &str, value: &str)[src]

Attaches a tag to this span.

pub fn with_tag(self, key: &str, value: &str) -> OpenSpan<T>[src]

A builder-style version of tag.

impl OpenSpan<Attached>[src]

pub fn detach(self) -> OpenSpan<Detached>[src]

Detaches this span's context from the tracer.

impl OpenSpan<Detached>[src]

pub fn attach(self) -> OpenSpan<Attached>[src]

Re-attaches this span's context to the tracer.

Important traits for Bind<T>
pub fn bind<F>(self, future: F) -> Bind<F> where
    F: Future
[src]

Binds this span to a future.

Returns a new future which sets the span's context as the current when polled before delegating to the inner future. The span will close when the future is dropped.

Trait Implementations

impl<T> Drop for OpenSpan<T>[src]

Auto Trait Implementations

impl<T> Send for OpenSpan<T> where
    T: Send

impl<T> Sync for OpenSpan<T> where
    T: Sync

impl<T> Unpin for OpenSpan<T> where
    T: Unpin

impl<T> UnwindSafe for OpenSpan<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for OpenSpan<T> where
    T: RefUnwindSafe

Blanket Implementations

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

impl<T> From<T> for 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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

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