pub struct OtelInternalExtension { /* private fields */ }Expand description
Extension that flushes OpenTelemetry spans after each Lambda invocation.
This extension is responsible for:
- Receiving completion signals from the handler
- Flushing spans at the appropriate time
- Managing the lifecycle of the tracer provider
The extension operates asynchronously to minimize impact on handler latency. It uses a channel-based communication pattern to coordinate with the handler.
Implementations§
Source§impl OtelInternalExtension
impl OtelInternalExtension
Sourcepub fn new(
request_done_receiver: UnboundedReceiver<()>,
tracer_provider: Arc<TracerProvider>,
) -> Self
pub fn new( request_done_receiver: UnboundedReceiver<()>, tracer_provider: Arc<TracerProvider>, ) -> Self
Creates a new OtelInternalExtension.
§Arguments
request_done_receiver- Channel receiver for completion signalstracer_provider- TracerProvider for span management
Sourcepub async fn invoke(&self, event: LambdaEvent) -> Result<(), Error>
pub async fn invoke(&self, event: LambdaEvent) -> Result<(), Error>
Handles extension events and flushes telemetry after each invocation.
This method:
- Waits for an INVOKE event
- Waits for the handler to signal completion
- Flushes all pending spans
§Arguments
event- The Lambda extension event to handle
§Returns
Returns Ok(()) if successful, or an Error if something went wrong
Auto Trait Implementations§
impl !Freeze for OtelInternalExtension
impl !RefUnwindSafe for OtelInternalExtension
impl Send for OtelInternalExtension
impl Sync for OtelInternalExtension
impl Unpin for OtelInternalExtension
impl !UnwindSafe for OtelInternalExtension
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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::Request