Struct reqwest_tracing::OtelName
source · pub struct OtelName(pub Cow<'static, str>);Expand description
OtelName allows customisation of the name of the spans created by
DefaultSpanBackend and SpanBackendWithUrl.
Usage:
use reqwest_middleware::{ClientBuilder, Extension};
use reqwest_tracing::{
TracingMiddleware, OtelName
};
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(OtelName("my-client".into())))
// 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(OtelName("POST /payment".into()))
.send()
.await
.unwrap();Tuple Fields§
§0: Cow<'static, str>Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for OtelName
impl Send for OtelName
impl Sync for OtelName
impl Unpin for OtelName
impl UnwindSafe for OtelName
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