pub struct HealthClient { /* private fields */ }Expand description
Client for probing a service’s /health endpoint over HTTP.
The ControlServerPlugin registers a HealthClient component pointed at
its own health endpoint; it can also be built directly with
new to probe a remote service (for example to wait for
a dependency to become ready).
Implementations§
Source§impl HealthClient
impl HealthClient
Sourcepub fn new(endpoint: String) -> Self
pub fn new(endpoint: String) -> Self
Creates a client that probes endpoint.
endpoint must be the full health URL, for example
http://127.0.0.1:8080/health.
Sourcepub async fn health_check(&self) -> Result<(), HealthCheckError>
pub async fn health_check(&self) -> Result<(), HealthCheckError>
Performs a single health probe.
§Errors
Returns a HealthCheckError if the request cannot be sent or the
endpoint responds with a non-success status.
Sourcepub async fn wait_for_ready(
&self,
timeout: Duration,
) -> Result<(), HealthCheckError>
pub async fn wait_for_ready( &self, timeout: Duration, ) -> Result<(), HealthCheckError>
Polls the endpoint until it reports healthy or timeout elapses,
retrying every 100 ms.
§Errors
Returns the last HealthCheckError if the endpoint is still not healthy
when timeout elapses.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HealthClient
impl !UnwindSafe for HealthClient
impl Freeze for HealthClient
impl Send for HealthClient
impl Sync for HealthClient
impl Unpin for HealthClient
impl UnsafeUnpin for HealthClient
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request