logo
pub struct SpanRef<'a>(_);
Available on crate feature trace only.
Expand description

A reference to the currently active span in this context.

Implementations

Record an event in the context this span.

Note that the OpenTelemetry project documents certain “standard attributes” that have prescribed semantic meanings and are available via the opentelemetry_semantic_conventions crate.

Record an error as an event for this span.

An additional call to Span::set_status is required if the status of the span should be set to error, as this method does not change the span status.

If this span is not being recorded then this method does nothing.

Record an event with a timestamp in the context this span.

Note that the OpenTelemetry project documents certain “standard attributes” that have prescribed semantic meanings and are available via the opentelemetry_semantic_conventions crate.

A reference to the SpanContext for this span.

Returns true if this span is recording information.

Spans will not be recording information after they have ended.

This flag may be true despite the entire trace being sampled out. This allows recording and processing of information about the individual spans without sending it to the backend. An example of this scenario may be recording and processing of all incoming requests for the processing and building of SLA/SLO latency charts while sending only a subset - sampled spans - to the backend.

Set an attribute of this span.

Setting an attribute with the same key as an existing attribute generally overwrites the existing attribute’s value.

Note that the OpenTelemetry project documents certain “standard attributes” that have prescribed semantic meanings and are available via the opentelemetry_semantic_conventions crate.

Set multiple attributes of this span.

Setting an attribute with the same key as an existing attribute generally overwrites the existing attribute’s value.

Note that the OpenTelemetry project documents certain “standard attributes” that have prescribed semantic meanings and are available via the opentelemetry_semantic_conventions crate.

Sets the status of this Span.

If used, this will override the default span status, which is Status::Unset.

Updates the span’s name.

After this update, any sampling behavior based on the name will depend on the implementation.

Signals that the operation described by this span has now ended.

Signals that the operation described by this span ended at the given time.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more

Attaches the current Context to this type, returning a WithContext wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.