[][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.

Implementations

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(mut self: 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(mut self: 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(
    mut self: 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(mut self: 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(mut self: Self, key: &str, value: &str) -> OpenSpan<T>[src]

A builder-style version of tag.

impl OpenSpan<Attached>[src]

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

Detaches this span's context from the tracer.

impl OpenSpan<Detached>[src]

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

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

pub fn bind<F>(self, future: F) -> Bind<F>

Notable traits for Bind<T>

impl<T> Future for Bind<T> where
    T: Future
type Output = T::Output;
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> RefUnwindSafe for OpenSpan<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for OpenSpan<T> where
    T: Send
[src]

impl<T> Sync for OpenSpan<T> where
    T: Sync
[src]

impl<T> Unpin for OpenSpan<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for OpenSpan<T> where
    T: UnwindSafe
[src]

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>,