Struct ActionSpan

Source
pub struct ActionSpan {
    pub ref_count: usize,
    pub trace_id: [u8; 16],
    pub span_id: [u8; 8],
    pub trace_state: String,
    pub parent_span_id: Option<[u8; 8]>,
    pub metadata: Option<&'static Metadata<'static>>,
    pub kind: TraceKind,
    pub start: SystemTime,
    pub end: SystemTime,
    pub attributes: HashMap<&'static str, AttributeValue>,
    pub events: Vec<ActionEvent>,
    pub status: SpanStatus,
}

Fields§

§ref_count: usize§trace_id: [u8; 16]

A unique identifier for a trace. All spans from the same trace share the same trace_id. The ID is a 16-byte array. An ID with all zeroes is considered invalid.

§span_id: [u8; 8]

A unique identifier for a span within a trace, assigned when the span is created. The ID is an 8-byte array. An ID with all zeroes is considered invalid.

§trace_state: String

trace_state conveys information about request position in multiple distributed tracing graphs. It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header See also https://github.com/w3c/distributed-tracing for more details about this field.

§parent_span_id: Option<[u8; 8]>

The span_id of this span’s parent span. If this is a root span, then this field must be empty.

§metadata: Option<&'static Metadata<'static>>

A description of the span, with its name inside.

§kind: TraceKind

Distinguishes between spans generated in a particular context. For example, two spans with the same name may be distinguished using CLIENT (caller) and SERVER (callee) to identify queueing latency associated with the span.

§start: SystemTime

start_time_unix_nano is the start time of the span. On the client side, this is the time kept by the local machine where the span execution starts. On the server side, this is the time when the server’s application handler starts running. Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.

This field is semantically required and it is expected that end_time >= start_time.

§end: SystemTime

end_time_unix_nano is the end time of the span. On the client side, this is the time kept by the local machine where the span execution ends. On the server side, this is the time when the server application handler stops running. Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.

This field is semantically required and it is expected that end_time >= start_time.

§attributes: HashMap<&'static str, AttributeValue>

attributes is a collection of key/value pairs.

The OpenTelemetry API specification further restricts the allowed value types: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key).

§events: Vec<ActionEvent>

events is a collection of Event items.

§status: SpanStatus

Implementations§

Source§

impl ActionSpan

Source

pub fn start_root(&mut self, attributes: &Attributes<'_>)

Source

pub fn start_child( &mut self, attributes: &Attributes<'_>, trace_id: &[u8; 16], parent_span_id: &[u8; 8], )

Source

pub fn end(&mut self)

Trait Implementations§

Source§

impl Clone for ActionSpan

Source§

fn clone(&self) -> ActionSpan

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ActionSpan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ActionSpan

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Visit for ActionSpan

Source§

fn record_debug(&mut self, field: &Field, value: &dyn Debug)

Visit a value implementing fmt::Debug.
Source§

fn record_f64(&mut self, field: &Field, value: f64)

Visit a double-precision floating point value.
Source§

fn record_i64(&mut self, field: &Field, value: i64)

Visit a signed 64-bit integer value.
Source§

fn record_u64(&mut self, field: &Field, value: u64)

Visit an unsigned 64-bit integer value.
Source§

fn record_i128(&mut self, field: &Field, value: i128)

Visit a signed 128-bit integer value.
Source§

fn record_u128(&mut self, field: &Field, value: u128)

Visit an unsigned 128-bit integer value.
Source§

fn record_bool(&mut self, field: &Field, value: bool)

Visit a boolean value.
Source§

fn record_str(&mut self, field: &Field, value: &str)

Visit a string value.
Source§

fn record_error(&mut self, field: &Field, value: &(dyn Error + 'static))

Records a type implementing Error. Read more
Source§

fn record_bytes(&mut self, field: &Field, value: &[u8])

Visit a byte slice.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more