pub struct HealthCheckInspect { /* private fields */ }Expand description
Mirrors a driver’s most recent health check result into its own Inspect hierarchy.
The Rust SDK does not record health check results into a driver’s Inspect tree automatically.
A driver that wants its latest health check visible in its own component Inspect hierarchy (at
root/driver_health_check, matching the C++ driver SDK schema) creates one of these with the
node it wants the record under and calls Self::record from its
crate::Driver::health_check:
async fn health_check(&self, request: HealthCheckRequest) -> HealthCheckResult {
let result = self.check_hardware(request).await;
self.health_inspect.record(request, &result);
result
}Nothing here depends on how the driver publishes Inspect: it works the same with
crate::DriverContext::publish_inspect, with
crate::DriverContext::inspect_content_publisher, or with an inspector the driver serves
itself. Drivers that build their Inspect tree on demand can instead call
record_health_check_to_inspect while populating it.
Implementations§
Source§impl HealthCheckInspect
impl HealthCheckInspect
Sourcepub fn new(parent: &Node) -> Self
pub fn new(parent: &Node) -> Self
Creates a recorder that writes its HEALTH_INSPECT_NODE_NAME child under parent.
Only a weak reference to parent is kept: the driver stays the owner of its Inspect
tree, and records are silently dropped once parent has been removed from it.
Sourcepub fn record(&self, level: HealthCheckRequest, result: &HealthCheckResult)
pub fn record(&self, level: HealthCheckRequest, result: &HealthCheckResult)
Records the result of a health check at level.
To avoid erasing diagnostic state with a routine liveness sweep or a skipped check,
non-informative errors (HealthCheckError::NotSupported,
HealthCheckError::Unavailable, HealthCheckError::InvalidState) and a healthy
HealthCheckRequest::Ping do not overwrite an existing informative record from a deeper
check.
Sourcepub fn record_alert(&self, alert: &HealthAlert)
pub fn record_alert(&self, alert: &HealthAlert)
Records the details of a HealthAlert::SelfFault the driver is reporting through its
HealthAlertReporter, replacing the previous record, so Inspect also reflects faults
the driver notices between health checks. Neighbour faults describe other drivers and are
ignored.
Auto Trait Implementations§
impl !Freeze for HealthCheckInspect
impl !RefUnwindSafe for HealthCheckInspect
impl !UnwindSafe for HealthCheckInspect
impl Send for HealthCheckInspect
impl Sync for HealthCheckInspect
impl Unpin for HealthCheckInspect
impl UnsafeUnpin for HealthCheckInspect
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
Source§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
Source§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to Self§impl<T> IntoAny for T
impl<T> IntoAny for T
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