Struct zipkin::tracer::OpenSpan
[−]
[src]
pub struct OpenSpan<T> where
T: Attachment, { /* 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 its
tracer'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 futures-zipkin
crate provides a wrapper type which ensures a context is
registered as the current whenever a task is running. 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> where
T: Attachment,
[src]
T: Attachment,
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]
impl OpenSpan<Detached>
[src]
Trait Implementations
impl<T> Drop for OpenSpan<T> where
T: Attachment,
[src]
T: Attachment,