pub struct SnsEventExtractor;Expand description
Extractor for SNS notification events.
SNS events may carry trace context in two locations within message_attributes:
- W3C
traceparent/tracestate- injected by OTel-instrumented producers AWSTraceHeader- X-Ray format set by AWS
This extractor checks both, preferring W3C format when available.
Per OpenTelemetry semantic conventions for messaging systems, this extractor:
- Does NOT set a parent context (returns current context)
- Creates span links for each message’s trace context
This approach is appropriate because the async nature of message queues means span links are more semantically correct than parent-child relationships.
§Example
ⓘ
use opentelemetry_lambda_tower::{OtelTracingLayer, SnsEventExtractor};
let layer = OtelTracingLayer::new(SnsEventExtractor::new());Implementations§
Trait Implementations§
Source§impl Clone for SnsEventExtractor
impl Clone for SnsEventExtractor
Source§fn clone(&self) -> SnsEventExtractor
fn clone(&self) -> SnsEventExtractor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SnsEventExtractor
impl Debug for SnsEventExtractor
Source§impl Default for SnsEventExtractor
impl Default for SnsEventExtractor
Source§fn default() -> SnsEventExtractor
fn default() -> SnsEventExtractor
Returns the “default value” for a type. Read more
Source§impl TraceContextExtractor<SnsEvent> for SnsEventExtractor
impl TraceContextExtractor<SnsEvent> for SnsEventExtractor
Source§fn extract_context(&self, _event: &SnsEvent) -> Context
fn extract_context(&self, _event: &SnsEvent) -> Context
Extracts parent context for creating child spans. Read more
Source§fn extract_links(&self, event: &SnsEvent) -> Vec<Link>
fn extract_links(&self, event: &SnsEvent) -> Vec<Link>
Extracts span links for async message correlation. Read more
Source§fn trigger_type(&self) -> &'static str
fn trigger_type(&self) -> &'static str
Returns the FaaS trigger type for semantic conventions. Read more
Auto Trait Implementations§
impl Freeze for SnsEventExtractor
impl RefUnwindSafe for SnsEventExtractor
impl Send for SnsEventExtractor
impl Sync for SnsEventExtractor
impl Unpin for SnsEventExtractor
impl UnwindSafe for SnsEventExtractor
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