pub struct Span {
pub trace_id: TraceId,
pub span_id: SpanId,
pub operation_name: String,
pub references: Vec<Reference>,
pub start_time: i64,
pub duration: i64,
pub tags: Vec<Tag>,
pub logs: Vec<Log>,
pub process_id: String,
pub warnings: Option<Vec<String>>,
}
Expand description
Individual span within a distributed trace.
A span represents a single operation within a trace, containing timing information, metadata, references to other spans, and associated process information.
Fields§
§trace_id: TraceId
The trace ID this span belongs to
span_id: SpanId
Unique identifier for this span
operation_name: String
Human-readable name of the operation this span represents
references: Vec<Reference>
References to other spans (e.g., parent-child relationships)
start_time: i64
Timestamp when this span started (in microseconds since epoch)
duration: i64
Duration of this span in microseconds
Key-value tags providing metadata about this span
logs: Vec<Log>
Log entries recorded during this span’s execution
process_id: String
ID of the process that created this span
warnings: Option<Vec<String>>
Any warnings associated with this span
Implementations§
Source§impl Span
impl Span
Sourcepub fn find_reference(&self, ref_type: &str) -> Option<&Reference>
pub fn find_reference(&self, ref_type: &str) -> Option<&Reference>
Sourcepub fn get_parent_reference(&self) -> Option<&Reference>
pub fn get_parent_reference(&self) -> Option<&Reference>
Gets the parent reference for this span.
This is a convenience method that specifically looks for a “CHILD_OF” reference, which indicates the parent span in the trace hierarchy.
§Returns
The parent reference if this span has one, or None
if this is a root span
§Example
use telemetry_rust::test::jaegar::Span;
use telemetry_rust::test::{SpanId, TraceId};
// Example of using get_parent_reference in span verification:
fn verify_parent_relationship(
span: &Span,
expected_trace_id: TraceId,
expected_parent_span_id: SpanId,
) {
let parent_reference = span.get_parent_reference().unwrap();
assert_eq!(parent_reference.trace_id, expected_trace_id);
assert_eq!(parent_reference.span_id, expected_parent_span_id);
}
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>,
impl StructuralPartialEq for Span
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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>
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 moreSource§impl<B> IntoFunctionResponse<B, Body> for Bwhere
B: Serialize,
impl<B> IntoFunctionResponse<B, Body> for Bwhere
B: Serialize,
Source§fn into_response(self) -> FunctionResponse<B, Body>
fn into_response(self) -> FunctionResponse<B, Body>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request