pub struct Span {
pub context: SpanContext,
pub name: String,
pub kind: SpanKind,
pub status: SpanStatus,
pub status_message: Option<String>,
pub start_time: DateTime<Utc>,
pub end_time: Option<DateTime<Utc>>,
pub attributes: HashMap<String, Value>,
pub events: Vec<SpanEvent>,
pub node_id: Option<Uuid>,
}Expand description
A trace span.
Fields§
§context: SpanContextSpan context.
name: StringSpan name.
kind: SpanKindSpan kind.
status: SpanStatusSpan status.
status_message: Option<String>Status message (for errors).
start_time: DateTime<Utc>Start time.
end_time: Option<DateTime<Utc>>End time.
attributes: HashMap<String, Value>Attributes.
events: Vec<SpanEvent>Events within the span.
node_id: Option<Uuid>Node ID that generated this span.
Implementations§
Source§impl Span
impl Span
Sourcepub fn with_attribute(
self,
key: impl Into<String>,
value: impl Serialize,
) -> Self
pub fn with_attribute( self, key: impl Into<String>, value: impl Serialize, ) -> Self
Add an attribute.
Sourcepub fn with_node_id(self, node_id: Uuid) -> Self
pub fn with_node_id(self, node_id: Uuid) -> Self
Set the node ID.
Sourcepub fn with_parent(self, parent: &SpanContext) -> Self
pub fn with_parent(self, parent: &SpanContext) -> Self
Set from a parent context.
Sourcepub fn duration_ms(&self) -> Option<f64>
pub fn duration_ms(&self) -> Option<f64>
Get the duration in milliseconds.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if the span is complete.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Span
impl<'de> Deserialize<'de> for Span
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnwindSafe for Span
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more