pub struct MetricsHttpClient<C> { /* private fields */ }Available on crate feature
metrics only.Expand description
An HttpClient wrapper that records a huskarl.http.request counter for each request.
Wrap your HTTP client with this type to instrument all outbound requests made by the huskarl library — including JWKS fetches and token introspection calls.
§Labels
| Label | Values | Description |
|---|---|---|
host | request hostname | Identifies the remote server |
method | GET, POST, etc. | HTTP method |
outcome | success, error | Whether the request succeeded |
outcome is success when the server returned a 2xx response, and error for
connection failures or non-2xx responses.
§Example
let client = MetricsHttpClient::builder().inner(inner).build();Implementations§
Source§impl<C> MetricsHttpClient<C>
impl<C> MetricsHttpClient<C>
Sourcepub fn builder() -> MetricsHttpClientBuilder<C>
pub fn builder() -> MetricsHttpClientBuilder<C>
Creates a new MetricsHttpClient.
Source§impl<C> MetricsHttpClient<C>
impl<C> MetricsHttpClient<C>
Sourcepub fn into_inner(self) -> C
pub fn into_inner(self) -> C
Unwraps the inner client.
Trait Implementations§
Source§impl<C: HttpClient> HttpClient for MetricsHttpClient<C>
impl<C: HttpClient> HttpClient for MetricsHttpClient<C>
Source§fn execute(
&self,
request: Request<Bytes>,
idempotency: Idempotency,
) -> MaybeSendBoxFuture<'_, Result<HttpResponse, Error>>
fn execute( &self, request: Request<Bytes>, idempotency: Idempotency, ) -> MaybeSendBoxFuture<'_, Result<HttpResponse, Error>>
Executes an HTTP request and returns the fully-read response. Read more
Auto Trait Implementations§
impl<C> Freeze for MetricsHttpClient<C>where
C: Freeze,
impl<C> RefUnwindSafe for MetricsHttpClient<C>where
C: RefUnwindSafe,
impl<C> Send for MetricsHttpClient<C>where
C: Send,
impl<C> Sync for MetricsHttpClient<C>where
C: Sync,
impl<C> Unpin for MetricsHttpClient<C>where
C: Unpin,
impl<C> UnsafeUnpin for MetricsHttpClient<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for MetricsHttpClient<C>where
C: UnwindSafe,
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