pub trait SpanProperties {
type Attribute<'a>: AttributeLike
where Self: 'a;
// Required methods
fn operation_name(&self) -> Cow<'_, str>;
fn service(&self) -> Cow<'_, str>;
fn env(&self) -> Cow<'_, str>;
fn resource(&self) -> Cow<'_, str>;
fn status_code(&self) -> Option<u32>;
fn attributes(&self) -> impl Iterator<Item = Self::Attribute<'_>> + '_;
fn get_alternate_key<'b>(&self, key: &'b str) -> Option<Cow<'b, str>>;
}Expand description
A trait for accessing span properties needed for sampling decisions.
Provides methods for retrieving span metadata like operation name, service, environment, resource name, and status codes used by sampling rules.
Required Associated Types§
Sourcetype Attribute<'a>: AttributeLike
where
Self: 'a
type Attribute<'a>: AttributeLike where Self: 'a
The type of attribute that implements AttributeLike.
Required Methods§
Sourcefn operation_name(&self) -> Cow<'_, str>
fn operation_name(&self) -> Cow<'_, str>
Returns the operation name for the span.
The operation name is derived from span attributes and kind according to OpenTelemetry semantic conventions.
Sourcefn service(&self) -> Cow<'_, str>
fn service(&self) -> Cow<'_, str>
Returns the service name for the span.
The service name is extracted from resource attributes.
Sourcefn env(&self) -> Cow<'_, str>
fn env(&self) -> Cow<'_, str>
Returns the environment name for the span.
The environment is extracted from span or resource attributes.
Sourcefn resource(&self) -> Cow<'_, str>
fn resource(&self) -> Cow<'_, str>
Returns the resource name for the span.
The resource name is derived from span attributes and kind.
Sourcefn status_code(&self) -> Option<u32>
fn status_code(&self) -> Option<u32>
Returns the HTTP status code if present.
Returns None if the span does not have an HTTP status code attribute.
Sourcefn attributes(&self) -> impl Iterator<Item = Self::Attribute<'_>> + '_
fn attributes(&self) -> impl Iterator<Item = Self::Attribute<'_>> + '_
Returns an iterator over span attributes.
Sourcefn get_alternate_key<'b>(&self, key: &'b str) -> Option<Cow<'b, str>>
fn get_alternate_key<'b>(&self, key: &'b str) -> Option<Cow<'b, str>>
Returns an alternate key for the given attribute key.
This is used for mapping between different attribute naming conventions
(e.g., OpenTelemetry to Datadog). Returns Some(alternate_key) if a mapping exists,
or None if the attribute key has no alternate mapping.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".