pub struct Span {
pub env: MetaString,
pub version: MetaString,
pub component: MetaString,
pub kind: u32,
pub attributes: FastHashMap<MetaString, AttributeValue>,
/* private fields */
}Expand description
A span event.
Fields§
§env: MetaStringPer-span environment override. Overrides Trace.payload.env when non-empty.
version: MetaStringPer-span application version.
component: MetaStringInstrumentation component name.
kind: u32Span kind (OTel values): 0=unspecified, 1=internal, 2=server, 3=client, 4=producer, 5=consumer.
attributes: FastHashMap<MetaString, AttributeValue>Typed span-level attributes.
Implementations§
Source§impl Span
impl Span
Sourcepub fn new(
service: impl Into<MetaString>,
name: impl Into<MetaString>,
resource: impl Into<MetaString>,
span_type: impl Into<MetaString>,
span_id: u64,
parent_id: u64,
start: u64,
duration: u64,
error: i32,
) -> Self
pub fn new( service: impl Into<MetaString>, name: impl Into<MetaString>, resource: impl Into<MetaString>, span_type: impl Into<MetaString>, span_id: u64, parent_id: u64, start: u64, duration: u64, error: i32, ) -> Self
Creates a new Span with all required fields.
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_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: u64) -> Self
pub fn with_start(self, start: u64) -> Self
Sets the start timestamp.
Sourcepub fn with_duration(self, duration: u64) -> Self
pub fn with_duration(self, duration: u64) -> 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 (for example, web, db, lambda).
Sourcepub fn with_attributes(
self,
attributes: impl Into<Option<FastHashMap<MetaString, AttributeValue>>>,
) -> Self
pub fn with_attributes( self, attributes: impl Into<Option<FastHashMap<MetaString, AttributeValue>>>, ) -> Self
Replaces the span attributes 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 with_env(self, env: impl Into<MetaString>) -> Self
pub fn with_env(self, env: impl Into<MetaString>) -> Self
Sets the per-span environment override.
Sourcepub fn with_version(self, version: impl Into<MetaString>) -> Self
pub fn with_version(self, version: impl Into<MetaString>) -> Self
Sets the per-span application version.
Sourcepub fn with_component(self, component: impl Into<MetaString>) -> Self
pub fn with_component(self, component: impl Into<MetaString>) -> Self
Sets the instrumentation component.
Sourcepub fn set_resource(&mut self, resource: impl Into<MetaString>)
pub fn set_resource(&mut self, resource: impl Into<MetaString>)
Sets the resource name.
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 UnsafeUnpin 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> 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>
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_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read more§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more