pub struct TraceData {
pub trace_id: TraceId,
pub spans: Vec<Span>,
pub processes: HashMap<String, Process>,
pub warnings: Option<Vec<String>>,
}
Expand description
Complete trace data for a single distributed trace.
This structure contains all the information for a complete trace, including all spans that are part of the trace, process information, and any warnings that occurred during trace collection.
Fields§
§trace_id: TraceId
The unique identifier for this trace
spans: Vec<Span>
All spans that belong to this trace
processes: HashMap<String, Process>
Process information mapped by process ID
warnings: Option<Vec<String>>
Any warnings generated during trace collection
Implementations§
Source§impl TraceData
impl TraceData
Sourcepub fn find_span(&self, operation_name: &str) -> Option<&Span>
pub fn find_span(&self, operation_name: &str) -> Option<&Span>
Finds a span within this trace by its operation name.
§Arguments
operation_name
- The name of the operation to search for
§Returns
The first span found with the matching operation name, or None
if not found
§Example
use telemetry_rust::test::jaegar::{Span, TraceData};
use telemetry_rust::test::{SpanId, TraceId};
fn verify_span<'td>(
trace_data: &'td TraceData,
operation_name: &str,
trace_id: TraceId,
parent_span_id: SpanId,
service_name: &str,
) -> Option<&'td Span> {
let span = trace_data.find_span(operation_name)?;
assert_eq!(span.trace_id, trace_id);
let parent_reference = span.get_parent_reference().unwrap();
let process_id = &span.process_id;
assert_eq!(parent_reference.trace_id, trace_id);
assert_eq!(parent_reference.span_id, parent_span_id);
let main_process = trace_data.processes.get(process_id).unwrap();
assert_eq!(main_process.service_name, service_name);
Some(span)
}
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TraceData
impl<'de> Deserialize<'de> for TraceData
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
impl StructuralPartialEq for TraceData
Auto Trait Implementations§
impl Freeze for TraceData
impl RefUnwindSafe for TraceData
impl Send for TraceData
impl Sync for TraceData
impl Unpin for TraceData
impl UnwindSafe for TraceData
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> 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>
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 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>
Convert the type into a FunctionResponse.
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>
Wrap the input message
T
in a tonic::Request
Creates a shared type from an unshared type.