pub struct OtelAxumLayer { /* private fields */ }Expand description
layer/middleware for axum:
- propagate
OpenTelemetrycontext (trace_id,…) to server - create a Span for
OpenTelemetry(and tracing) on call
OpenTelemetry context are extracted from tracing’s span.
Implementations§
Source§impl OtelAxumLayer
impl OtelAxumLayer
pub fn filter(self, filter: Filter) -> Self
Sourcepub fn try_extract_client_ip(self, enable: bool) -> Self
pub fn try_extract_client_ip(self, enable: bool) -> Self
Enable or disable (default) the extraction of client’s ip. Extraction from (in order):
- http header ‘Forwarded’
- http header
X-Forwarded-For - socket connection ip, use the
axum::extract::ConnectionInfo(seeRouter::into_make_service_with_connect_infofor more details) - empty (failed to extract the information)
The extracted value could an ip v4, ip v6, a string (as Forwarded can use label or hide the client).
The extracted value is stored it as client.address in the span/trace
Trait Implementations§
Source§impl Clone for OtelAxumLayer
impl Clone for OtelAxumLayer
Source§fn clone(&self) -> OtelAxumLayer
fn clone(&self) -> OtelAxumLayer
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 OtelAxumLayer
impl Debug for OtelAxumLayer
Source§impl Default for OtelAxumLayer
impl Default for OtelAxumLayer
Source§fn default() -> OtelAxumLayer
fn default() -> OtelAxumLayer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OtelAxumLayer
impl RefUnwindSafe for OtelAxumLayer
impl Send for OtelAxumLayer
impl Sync for OtelAxumLayer
impl Unpin for OtelAxumLayer
impl UnwindSafe for OtelAxumLayer
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