[−][src]Struct zipkin::OpenSpan
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]
mut self: Self,
remote_endpoint: Endpoint
) -> OpenSpan<T>
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>ⓘ where
F: Future,
[src]
F: Future,
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
Auto Trait Implementations
impl<T> RefUnwindSafe for OpenSpan<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for OpenSpan<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for OpenSpan<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for OpenSpan<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for OpenSpan<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,