pub struct Span { /* private fields */ }Expand description
A span event.
Implementations§
Source§impl Span
impl Span
Sourcepub fn new(
service: impl Into<MetaString>,
name: impl Into<MetaString>,
resource: impl Into<MetaString>,
trace_id: u64,
span_id: u64,
) -> Self
pub fn new( service: impl Into<MetaString>, name: impl Into<MetaString>, resource: impl Into<MetaString>, trace_id: u64, span_id: u64, ) -> Self
Creates a new Span with the required identifiers and names.
Sourcepub fn with_service(self, service: impl Into<MetaString>) -> Self
pub fn with_service(self, service: impl Into<MetaString>) -> Self
Sets the service name.
Sourcepub fn with_resource(self, resource: impl Into<MetaString>) -> Self
pub fn with_resource(self, resource: impl Into<MetaString>) -> Self
Sets the resource name.
Sourcepub fn with_trace_id(self, trace_id: u64) -> Self
pub fn with_trace_id(self, trace_id: u64) -> Self
Sets the trace identifier.
Sourcepub fn with_span_id(self, span_id: u64) -> Self
pub fn with_span_id(self, span_id: u64) -> Self
Sets the span identifier.
Sourcepub fn with_parent_id(self, parent_id: u64) -> Self
pub fn with_parent_id(self, parent_id: u64) -> Self
Sets the parent span identifier.
Sourcepub fn with_start(self, start: i64) -> Self
pub fn with_start(self, start: i64) -> Self
Sets the start timestamp.
Sourcepub fn with_duration(self, duration: i64) -> Self
pub fn with_duration(self, duration: i64) -> Self
Sets the span duration.
Sourcepub fn with_error(self, error: i32) -> Self
pub fn with_error(self, error: i32) -> Self
Sets the error flag.
Sourcepub fn with_span_type(self, span_type: impl Into<MetaString>) -> Self
pub fn with_span_type(self, span_type: impl Into<MetaString>) -> Self
Sets the span type (e.g., web, db, lambda).
Sourcepub fn with_meta(
self,
meta: impl Into<Option<FastHashMap<MetaString, MetaString>>>,
) -> Self
pub fn with_meta( self, meta: impl Into<Option<FastHashMap<MetaString, MetaString>>>, ) -> Self
Replaces the string-valued tag map.
Sourcepub fn with_metrics(
self,
metrics: impl Into<Option<FastHashMap<MetaString, f64>>>,
) -> Self
pub fn with_metrics( self, metrics: impl Into<Option<FastHashMap<MetaString, f64>>>, ) -> Self
Replaces the numeric-valued tag map.
Sourcepub fn with_meta_struct(
self,
meta_struct: impl Into<Option<FastHashMap<MetaString, Vec<u8>>>>,
) -> Self
pub fn with_meta_struct( self, meta_struct: impl Into<Option<FastHashMap<MetaString, Vec<u8>>>>, ) -> Self
Replaces the structured metadata map.
Sourcepub fn with_span_links(
self,
span_links: impl Into<Option<Vec<SpanLink>>>,
) -> Self
pub fn with_span_links( self, span_links: impl Into<Option<Vec<SpanLink>>>, ) -> Self
Replaces the span links collection.
Sourcepub fn with_span_events(
self,
span_events: impl Into<Option<Vec<SpanEvent>>>,
) -> Self
pub fn with_span_events( self, span_events: impl Into<Option<Vec<SpanEvent>>>, ) -> Self
Replaces the span events collection.
Sourcepub fn meta_struct(&self) -> &FastHashMap<MetaString, Vec<u8>>
pub fn meta_struct(&self) -> &FastHashMap<MetaString, Vec<u8>>
Returns the structured metadata map.
Sourcepub fn span_links(&self) -> &[SpanLink]
pub fn span_links(&self) -> &[SpanLink]
Returns the span links collection.
Sourcepub fn span_events(&self) -> &[SpanEvent]
pub fn span_events(&self) -> &[SpanEvent]
Returns the span events collection.
Trait Implementations§
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
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> 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::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Track for T
impl<T> Track for T
§fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
Instruments this type by attaching the given allocation group token, returning a
Tracked wrapper. Read more§fn in_current_allocation_group(self) -> Tracked<Self>
fn in_current_allocation_group(self) -> Tracked<Self>
Instruments this type by attaching the current allocation group, returning a
Tracked wrapper. Read more