Struct opentracingrust::Span
[−]
[src]
pub struct Span { /* fields omitted */ }
Model of an in progress operation.
A Span
is to a distributed trace what a stack frame is to a stack trace.
Span
s are created by Tracer
s with Tracer::span
.
Span
s can be populated with StartOptions
passed to Tracer::span
and
with the mutating methods described below.
Once an operation is complete the span should be finished with Span::finished
.
Methods
impl Span
[src]
fn new(
name: &str,
context: SpanContext,
options: StartOptions,
sender: SpanSender
) -> Span
[src]
name: &str,
context: SpanContext,
options: StartOptions,
sender: SpanSender
) -> Span
Creates a new Span
instance and initialises any passed StartOptions
.
This function is for use by TracerInterface
implementations in their
TracerInterface::span
method.
The sender
argument is the sending end of an mpsc::channel
.
The receiving end of this channel, usually returned by the tracer's initialisation
routine, will gather FinishedSpan
s so they can be shipped to the distributed tracer.
impl Span
[src]
fn auto_finish(self) -> AutoFinishingSpan
[src]
Convert the running Span
into an AutoFinishingSpan
.
Span
s instances need to be finished
for the information to be sent.
If a Span
goes out of scope the information in it is lost and the span
is never sent to the distributed tracer.
The AutoFinishingSpan
wrapper allows a Span
to be finished when it goes out of scope.
Panics
While this function never panics, keep in mind that the AutoFinishingSpan
panics if Span::finish
fails.
fn child_of(&mut self, parent: SpanContext)
[src]
Marks this span as a child of the given context.
fn context(&self) -> &SpanContext
[src]
Access the SpanContext
of this span.
fn finish_time(&mut self, finish_time: SystemTime)
[src]
Set the span finish time.
This method allows to set the finish time of an operation explicitly and still manipulate the span further. This allows to time the operation first and the populate the span with any available detail without obfuscating the duration of the real operation.
fn finish(self) -> Result<()>
[src]
Finished a span and sends it to the tracer's receiver..
Consumes a Span
to create a FinishedSpan
.
The finished span is then send to the tracer's mpsc::Receiver
associated
with the span at the time of creation.
Any error sending the span is returned to the caller.
fn follows(&mut self, parent: SpanContext)
[src]
Marks this span as a follower of the given context.
fn get_baggage_item(&self, key: &str) -> Option<&String>
[src]
Attempt to fetch a baggage item by key.
If there is no item with the given key this method returns None
.
fn operation_name(&self) -> &str
[src]
Returns the operation name.
fn reference_span(&mut self, reference: SpanReference)
[src]
Adds a reference to a SpanContext
.
fn references(&self) -> &[SpanReference]
[src]
Access all referenced span contexts and their relationship.
fn set_baggage_item(&mut self, key: &str, value: &str)
[src]
Adds or updates the baggage items with the given key/value pair.
Baggage items are forwarded to Span
s that reference this Span
and all the Span
s that reference them.
Baggage items are NOT propagated backwards to Span
s that reference this Span
.
fn set_operation_name(&mut self, name: &str)
[src]
Updates the operation name.
fn tag<TV: Into<TagValue>>(&mut self, tag: &str, value: TV)
[src]
Append a tag to the span.
Examples
extern crate opentracingrust; use opentracingrust::tracers::NoopTracer; fn main() { let (tracer, _) = NoopTracer::new(); let mut span = tracer.span("some_work"); span.tag("client.name", "some-tracing-client"); span.tag("client.version", 3.4); // ... snip ... }
Trait Implementations
impl Clone for Span
[src]
fn clone(&self) -> Span
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more