Struct AwsSpanBuilder

Source
pub struct AwsSpanBuilder<'a> { /* private fields */ }
Expand description

Builder for creating AWS-specific OpenTelemetry spans.

This builder provides a fluent interface for constructing AwsSpan with required attributes and proper span kinds for different types of AWS operations. It automatically sets standard RPC attributes following OpenTelemetry semantic conventions for AWS services.

§Usage

This builder can be used with AwsInstrument trait to instrument any AWS operation, or to manually create AwsSpan if you need control over span lifecycle. For automatic instrumentation, use AwsBuilderInstrument trait.

Implementations§

Source§

impl AwsSpanBuilder<'_>

Source

pub fn dynamodb( method: impl Into<StringValue>, table_names: impl IntoIterator<Item = impl Into<StringValue>>, ) -> Self

Creates a DynamoDB operation span builder.

This method creates a span builder configured for DynamoDB operations with appropriate semantic attributes according to OpenTelemetry conventions.

§Arguments
  • method - The DynamoDB operation method name (e.g., “GetItem”, “PutItem”)
  • table_names - Iterator of table names involved in the operation
§Returns

A configured AWS span builder for the DynamoDB operation

Source§

impl AwsSpanBuilder<'_>

Source

pub fn firehose( operation_kind: MessagingOperationKind, method: impl Into<StringValue>, stream_name: Option<impl Into<StringValue>>, ) -> Self

Creates a Firehose operation span builder.

This method creates a span builder configured for Firehose operations with appropriate messaging semantic attributes.

§Arguments
  • operation_kind - The type of messaging operation being performed
  • method - The Firehose operation method name
  • stream_name - Optional stream name for operations that target specific streams
Source§

impl AwsSpanBuilder<'_>

Source

pub fn sns( operation_kind: MessagingOperationKind, method: impl Into<StringValue>, topic_arn: Option<impl Into<StringValue>>, ) -> Self

Creates an SNS operation span builder.

This method creates a span builder configured for SNS operations with appropriate messaging semantic attributes.

§Arguments
  • operation_kind - The type of messaging operation being performed
  • method - The SNS operation method name
  • topic_arn - Optional topic ARN for operations that target specific topics
Source§

impl AwsSpanBuilder<'_>

Source

pub fn sqs( operation_kind: MessagingOperationKind, method: impl Into<StringValue>, queue: Option<impl Into<StringValue>>, ) -> Self

Creates an SQS operation span builder.

This method creates a span builder configured for SQS operations with appropriate messaging semantic attributes.

§Arguments
  • operation_kind - The type of messaging operation being performed
  • method - The SQS operation method name
  • queue - Optional SQS queue URL or name for operations that target specific queues
Source§

impl<'a> AwsSpanBuilder<'a>

Source

pub fn client( service: impl Into<StringValue>, method: impl Into<StringValue>, attributes: impl IntoIterator<Item = KeyValue>, ) -> Self

Creates a client span builder for AWS operations.

Client spans represent outbound calls to AWS services from your application.

§Arguments
  • service - The AWS service name (e.g., “S3”, “DynamoDB”)
  • method - The operation name (e.g., “GetObject”, “PutItem”)
  • attributes - Additional custom attributes for the span
Source

pub fn producer( service: impl Into<StringValue>, method: impl Into<StringValue>, attributes: impl IntoIterator<Item = KeyValue>, ) -> Self

Creates a producer span builder for AWS operations.

Producer spans represent operations that send messages or data to AWS services.

§Arguments
  • service - The AWS service name (e.g., “SQS”, “SNS”)
  • method - The operation name (e.g., “SendMessage”, “Publish”)
  • attributes - Additional custom attributes for the span
Source

pub fn consumer( service: impl Into<StringValue>, method: impl Into<StringValue>, attributes: impl IntoIterator<Item = KeyValue>, ) -> Self

Creates a consumer span builder for AWS operations.

Consumer spans represent operations that receive messages or data from AWS services.

§Arguments
  • service - The AWS service name (e.g., “SQS”, “Kinesis”)
  • method - The operation name (e.g., “ReceiveMessage”, “GetRecords”)
  • attributes - Additional custom attributes for the span
Source

pub fn attributes(self, iter: impl IntoIterator<Item = KeyValue>) -> Self

Adds multiple attributes to the span being built.

§Arguments
  • iter - An iterator of KeyValue attributes to add to the span
Source

pub fn attribute(self, attribute: KeyValue) -> Self

Adds a single attribute to the span being built.

This is a convenience method for adding one attribute at a time.

§Arguments
  • attribute - The KeyValue attribute to add to the span
Source

pub fn context(self, context: &'a Context) -> Self

Sets the parent Context for the span.

§Arguments
  • context - The OpenTelemetry Context to use as the parent
Source

pub fn set_context(self, context: Option<&'a Context>) -> Self

Optionally sets the parent Context for the span.

§Arguments
  • context - An optional OpenTelemetry Context to use as the parent
Source

pub fn start(self) -> AwsSpan

Starts the span and returns an AwsSpan.

This method creates and starts the span using either the explicitly set context or the current tracing span’s context as the parent.

Auto Trait Implementations§

§

impl<'a> Freeze for AwsSpanBuilder<'a>

§

impl<'a> !RefUnwindSafe for AwsSpanBuilder<'a>

§

impl<'a> Send for AwsSpanBuilder<'a>

§

impl<'a> Sync for AwsSpanBuilder<'a>

§

impl<'a> Unpin for AwsSpanBuilder<'a>

§

impl<'a> !UnwindSafe for AwsSpanBuilder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,