pub struct HttpClientLayer { /* private fields */ }Expand description
Instruments an HTTP client, as the OpenTelemetry semantic conventions for HTTP clients describe:
- A span per request, named for the method, with
http.request.method,server.address,server.port,url.full(without credentials or query),network.protocol.version,http.response.status_code, anderror.typewith status Error for 4xx and 5xx responses and failed requests. - W3C
traceparentandtracestateon each request, so the server continues the trace. http.client.request.duration(seconds) through themetricsfacade, by method, server address and port, scheme, status anderror.type.
For a client that isn’t a tower service, ClientCall records the
same.
Implementations§
Source§impl HttpClientLayer
impl HttpClientLayer
Sourcepub fn with_propagation(self, enabled: bool) -> Self
pub fn with_propagation(self, enabled: bool) -> Self
Send W3C trace context with each request. Default: true. Turn it off for requests leaving your trust boundary.
Sourcepub fn with_metrics(self, enabled: bool) -> Self
pub fn with_metrics(self, enabled: bool) -> Self
Record http.client.request.duration. Default: true.
Trait Implementations§
Source§impl Clone for HttpClientLayer
impl Clone for HttpClientLayer
Source§impl Default for HttpClientLayer
impl Default for HttpClientLayer
Auto Trait Implementations§
impl Forget for HttpClientLayer
impl Freeze for HttpClientLayer
impl Move for HttpClientLayer
impl RefUnwindSafe for HttpClientLayer
impl Send for HttpClientLayer
impl Sync for HttpClientLayer
impl Unpin for HttpClientLayer
impl UnsafeUnpin for HttpClientLayer
impl UnwindSafe for HttpClientLayer
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