Skip to main content

MetricsHttpClient

Struct MetricsHttpClient 

Source
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

LabelValuesDescription
hostrequest hostnameIdentifies the remote server
methodGET, POST, etc.HTTP method
outcomesuccess, errorWhether 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>

Source

pub fn builder() -> MetricsHttpClientBuilder<C>

Creates a new MetricsHttpClient.

Source§

impl<C> MetricsHttpClient<C>

Source

pub fn inner(&self) -> &C

Returns a reference to the inner client.

Source

pub fn into_inner(self) -> C

Unwraps the inner client.

Trait Implementations§

Source§

impl<C: HttpClient> HttpClient for MetricsHttpClient<C>

Source§

fn execute( &self, request: Request<Bytes>, idempotency: Idempotency, ) -> MaybeSendBoxFuture<'_, Result<HttpResponse, Error>>

Executes an HTTP request and returns the fully-read response. Read more
Source§

fn uses_mtls(&self) -> bool

Indicates whether this client uses mTLS for authentication. 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.