pub struct DMSCHealthChecker { /* private fields */ }Expand description
Main health checker service.
This struct provides the core functionality for managing health checks, including registering health checks, starting background monitoring, and retrieving health status.
Implementations§
Source§impl DMSCHealthChecker
impl DMSCHealthChecker
pub fn new(check_interval: Duration) -> Self
pub fn with_tracer(self, tracer: Arc<DMSCTracer>) -> Self
pub fn set_tracer(&mut self, tracer: Arc<DMSCTracer>)
Sourcepub async fn register_health_check(
&self,
service_name: &str,
endpoint: &str,
check_type: DMSCHealthCheckType,
config: DMSCHealthCheckConfig,
) -> DMSCResult<()>
pub async fn register_health_check( &self, service_name: &str, endpoint: &str, check_type: DMSCHealthCheckType, config: DMSCHealthCheckConfig, ) -> DMSCResult<()>
Registers a health check for a service.
This method registers a health check for a service and performs an immediate check.
§Parameters
service_name: Name of the service to checkendpoint: Endpoint URL for health checkscheck_type: Type of health check to performconfig: Health check configuration
§Returns
A DMSCResult<()> indicating success or failure
Sourcepub async fn start_health_check(
&self,
service_name: &str,
endpoint: &str,
) -> DMSCResult<()>
pub async fn start_health_check( &self, service_name: &str, endpoint: &str, ) -> DMSCResult<()>
Sourcepub async fn stop_health_check(
&self,
service_name: &str,
_endpoint: &str,
) -> DMSCResult<()>
pub async fn stop_health_check( &self, service_name: &str, _endpoint: &str, ) -> DMSCResult<()>
Stops health checks for a specific service endpoint.
This method clears the health check results for the specified service. The background task will continue running but will no longer record results.
§Parameters
service_name: Name of the serviceendpoint: Endpoint URL
§Returns
A DMSCResult<()> indicating success or failure
Sourcepub async fn start_health_check_with_type(
&self,
service_name: &str,
endpoint: &str,
check_type: DMSCHealthCheckType,
) -> DMSCResult<()>
pub async fn start_health_check_with_type( &self, service_name: &str, endpoint: &str, check_type: DMSCHealthCheckType, ) -> DMSCResult<()>
Starts background health checks for a service with a specific health check type.
This method creates a background task that periodically checks the health of a service using the specified health check type.
§Parameters
service_name: Name of the service to checkendpoint: Endpoint URL for health checkscheck_type: Type of health check to perform
§Returns
A DMSCResult<()> indicating success or failure
Sourcepub async fn get_health_status(
&self,
service_name: &str,
) -> DMSCResult<Vec<DMSCHealthCheckResult>>
pub async fn get_health_status( &self, service_name: &str, ) -> DMSCResult<Vec<DMSCHealthCheckResult>>
Sourcepub async fn get_latest_health_status(
&self,
service_name: &str,
) -> DMSCResult<Option<DMSCHealthCheckResult>>
pub async fn get_latest_health_status( &self, service_name: &str, ) -> DMSCResult<Option<DMSCHealthCheckResult>>
Sourcepub async fn get_health_status_within(
&self,
service_name: &str,
time_window: Duration,
) -> DMSCResult<Vec<DMSCHealthCheckResult>>
pub async fn get_health_status_within( &self, service_name: &str, time_window: Duration, ) -> DMSCResult<Vec<DMSCHealthCheckResult>>
Sourcepub async fn get_service_health_summary(
&self,
service_name: &str,
) -> DMSCResult<DMSCHealthSummary>
pub async fn get_service_health_summary( &self, service_name: &str, ) -> DMSCResult<DMSCHealthSummary>
Gets a health summary for a service.
This method aggregates health check results to provide a summary of the service’s health, including success rate, average response time, and overall status.
§Parameters
service_name: Name of the service to get a summary for
§Returns
A DMSCResult<DMSCHealthSummary> containing the health summary
Sourcepub async fn start_background_tasks(&self) -> DMSCResult<()>
pub async fn start_background_tasks(&self) -> DMSCResult<()>
Starts background health check tasks.
This method initializes and starts all background health monitoring tasks, including periodic health checks for registered services and cleanup tasks.
§Returns
A DMSCResult<()> indicating success or failure
Sourcepub async fn stop_background_tasks(&self) -> DMSCResult<()>
pub async fn stop_background_tasks(&self) -> DMSCResult<()>
Stops all background health check tasks.
This method aborts all running background health check tasks and cleans up resources.
§Returns
A DMSCResult<()> indicating success or failure
Sourcepub async fn health_check(&self) -> DMSCResult<bool>
pub async fn health_check(&self) -> DMSCResult<bool>
Performs a health check on the health checker itself.
§Returns
A DMSCResult<bool> indicating whether the health checker is healthy
Trait Implementations§
Source§impl<'py> IntoPyObject<'py> for DMSCHealthChecker
impl<'py> IntoPyObject<'py> for DMSCHealthChecker
Source§type Target = DMSCHealthChecker
type Target = DMSCHealthChecker
Source§type Output = Bound<'py, <DMSCHealthChecker as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <DMSCHealthChecker as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for DMSCHealthChecker
impl PyClass for DMSCHealthChecker
Source§impl PyClassImpl for DMSCHealthChecker
impl PyClassImpl for DMSCHealthChecker
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = c"Main health checker service.\n\nThis struct provides the core functionality for managing health checks, including\nregistering health checks, starting background monitoring, and retrieving health status.\x00"
const RAW_DOC: &'static CStr = c"Main health checker service.\n\nThis struct provides the core functionality for managing health checks, including\nregistering health checks, starting background monitoring, and retrieving health status.\x00"
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<DMSCHealthChecker>
type ThreadChecker = SendablePyClass<DMSCHealthChecker>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature for DMSCHealthChecker
impl PyClassNewTextSignature for DMSCHealthChecker
const TEXT_SIGNATURE: &'static str = "(check_interval)"
Source§impl PyMethods<DMSCHealthChecker> for PyClassImplCollector<DMSCHealthChecker>
impl PyMethods<DMSCHealthChecker> for PyClassImplCollector<DMSCHealthChecker>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for DMSCHealthChecker
impl PyTypeInfo for DMSCHealthChecker
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.impl DerefToPyAny for DMSCHealthChecker
impl ExtractPyClassWithClone for DMSCHealthChecker
Auto Trait Implementations§
impl Freeze for DMSCHealthChecker
impl !RefUnwindSafe for DMSCHealthChecker
impl Send for DMSCHealthChecker
impl Sync for DMSCHealthChecker
impl Unpin for DMSCHealthChecker
impl !UnwindSafe for DMSCHealthChecker
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read moreSource§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>
T in a tonic::RequestSource§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>
T in a tonic::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more