pub struct DisableOtelPropagation;
Expand description
DisableOtelPropagation
disables opentelemetry header propagation, while still tracing the HTTP request.
By default, the TracingMiddleware
middleware will also propagate any opentelemtry
contexts to the server. For any external facing requests, this can be problematic and it should be disabled.
Usage:
use reqwest_middleware::{ClientBuilder, Extension};
use reqwest_tracing::{
TracingMiddleware, DisableOtelPropagation
};
let reqwest_client = reqwest::Client::builder().build().unwrap();
let client = ClientBuilder::new(reqwest_client)
// Inserts the extension before the request is started
.with_init(Extension(DisableOtelPropagation))
// Makes use of that extension to specify the otel name
.with(TracingMiddleware::default())
.build();
let resp = client.get("https://truelayer.com").send().await.unwrap();
// Or specify it on the individual request (will take priority)
let resp = client.post("https://api.truelayer.com/payment")
.with_extension(DisableOtelPropagation)
.send()
.await
.unwrap();
Trait Implementations§
Source§impl Clone for DisableOtelPropagation
impl Clone for DisableOtelPropagation
Source§fn clone(&self) -> DisableOtelPropagation
fn clone(&self) -> DisableOtelPropagation
Returns a copy 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 moreAuto Trait Implementations§
impl Freeze for DisableOtelPropagation
impl RefUnwindSafe for DisableOtelPropagation
impl Send for DisableOtelPropagation
impl Sync for DisableOtelPropagation
impl Unpin for DisableOtelPropagation
impl UnwindSafe for DisableOtelPropagation
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