operations capa

operations-health

Health checks for Rust applications

Health checks for Rust applications

Tieroperations
Roleunclassified (baselined)
Pathcrates/operations/health
Edition2021
Targetsoperations_health
Public items56 across 0 modules
Tests23

What it is for

Health check library crates for Rust applications.

This crate provides abstractions for implementing health checks, readiness probes, and liveness probes for services.

Capabilities

AlwaysHealthy

Health check library crates for Rust applications.

Item
pub struct AlwaysHealthy
AlwaysHealthy :: fn new(name : impl Into <String>) -> Self
AlwaysHealthy :: fn name(& self) -> & str
AlwaysHealthy :: async fn check(& self) -> CheckResult

CheckResult

Health check library crates for Rust applications.

Item
pub struct CheckResult
CheckResult :: fn healthy(name : impl Into <String>) -> Self
CheckResult :: fn degraded(name : impl Into <String>, message : impl Into <String>) -> Self
CheckResult :: fn unhealthy(name : impl Into <String>, message : impl Into <String>) -> Self
CheckResult :: fn with_duration(mut self, duration_ms : u64) -> Self
CheckResult :: fn with_detail(mut self, key : impl Into <String>, value : impl Serialize) -> Self

DatabaseCheck

Health check library crates for Rust applications.

Item
pub struct DatabaseCheck
DatabaseCheck :: fn new <F>(name : impl Into <String>, check_fn : F) -> Self where F : Fn() -> bool + Send + Sync + 'static,
DatabaseCheck :: fn name(& self) -> & str
DatabaseCheck :: async fn check(& self) -> CheckResult

DependencyCheck

Health check library crates for Rust applications.

Item
pub struct DependencyCheck
DependencyCheck :: fn new(name : impl Into <String>, url : impl Into <String>) -> Self
DependencyCheck :: fn with_timeout(mut self, timeout : std::time::Duration) -> Self
DependencyCheck :: fn name(& self) -> & str
DependencyCheck :: async fn check(& self) -> CheckResult
DependencyCheck :: fn timeout(& self) -> std::time::Duration

HealthCheck

Health check library crates for Rust applications.

Item
pub trait HealthCheck

HealthChecker

Health check library crates for Rust applications.

Item
pub struct HealthChecker
HealthChecker :: fn new() -> Self
HealthChecker :: fn with_check(mut self, check : impl HealthCheck + 'static) -> Self
HealthChecker :: fn with_version(mut self, version : impl Into <String>) -> Self
HealthChecker :: fn with_service(mut self, service : impl Into <String>) -> Self
HealthChecker :: async fn check(& self) -> HealthResponse
HealthChecker :: async fn liveness(& self) -> HealthResponse
HealthChecker :: async fn readiness(& self) -> HealthResponse

HealthError

Health check library crates for Rust applications.

Item
pub enum HealthError

HealthResponse

Health check library crates for Rust applications.

Item
pub struct HealthResponse
HealthResponse :: fn new(checks : Vec <CheckResult>) -> Self
HealthResponse :: fn with_version(mut self, version : impl Into <String>) -> Self
HealthResponse :: fn with_service(mut self, service : impl Into <String>) -> Self
HealthResponse :: fn http_status_code(& self) -> u16

HealthStatus

Health check library crates for Rust applications.

Item
pub enum HealthStatus
HealthStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
HealthStatus :: fn is_ok(& self) -> bool
HealthStatus :: fn is_ready(& self) -> bool
HealthStatus :: fn is_alive(& self) -> bool
HealthStatus :: fn http_status_code(& self) -> u16

MemoryCheck

Health check library crates for Rust applications.

Item
pub struct MemoryCheck
MemoryCheck :: fn new(threshold_mb : u64) -> Self
MemoryCheck :: fn name(& self) -> & str
MemoryCheck :: async fn check(& self) -> CheckResult
MemoryCheck :: fn is_critical(& self) -> bool

Result

Health check library crates for Rust applications.

Item
pub type Result<T>: std::result::Result <T, HealthError>

ThresholdConfig

Health check library crates for Rust applications.

Item
pub struct ThresholdConfig
ThresholdConfig :: fn new(warning : f64, critical : f64) -> Self
ThresholdConfig :: fn evaluate(& self, value : f64) -> HealthStatus

UptimeCheck

Health check library crates for Rust applications.

Item
pub struct UptimeCheck
UptimeCheck :: fn new() -> Self
UptimeCheck :: fn default() -> Self
UptimeCheck :: fn name(& self) -> & str
UptimeCheck :: async fn check(& self) -> CheckResult
UptimeCheck :: fn is_critical(& self) -> bool

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
pub enum HealthErrorErrors that can occur with health checks.
pub type Result<T>: std::result::Result <T, HealthError>Result type for health operations.
pub enum HealthStatusHealth status.
HealthStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
HealthStatus :: fn is_ok(& self) -> boolReturns true if the status is healthy or degraded.
HealthStatus :: fn is_ready(& self) -> boolReturns true if the service should receive traffic.
HealthStatus :: fn is_alive(& self) -> boolReturns true if the service is alive.
HealthStatus :: fn http_status_code(& self) -> u16Returns the HTTP status code for this health status.
pub struct CheckResultResult of a health check.
CheckResult :: fn healthy(name : impl Into <String>) -> SelfCreates a healthy result.
CheckResult :: fn degraded(name : impl Into <String>, message : impl Into <String>) -> SelfCreates a degraded result.
CheckResult :: fn unhealthy(name : impl Into <String>, message : impl Into <String>) -> SelfCreates an unhealthy result.
CheckResult :: fn with_duration(mut self, duration_ms : u64) -> SelfSets the duration.
CheckResult :: fn with_detail(mut self, key : impl Into <String>, value : impl Serialize) -> SelfAdds a detail.
pub trait HealthCheckHealth check trait.
pub struct HealthResponseAggregated health response.
HealthResponse :: fn new(checks : Vec <CheckResult>) -> SelfCreates a new health response.
HealthResponse :: fn with_version(mut self, version : impl Into <String>) -> SelfSets the service version.
HealthResponse :: fn with_service(mut self, service : impl Into <String>) -> SelfSets the service name.
HealthResponse :: fn http_status_code(& self) -> u16Returns the HTTP status code.
pub struct HealthCheckerHealth checker that runs multiple checks.
HealthChecker :: fn new() -> SelfCreates a new health checker.
HealthChecker :: fn with_check(mut self, check : impl HealthCheck + 'static) -> SelfAdds a health check.
HealthChecker :: fn with_version(mut self, version : impl Into <String>) -> SelfSets the service version.
HealthChecker :: fn with_service(mut self, service : impl Into <String>) -> SelfSets the service name.
HealthChecker :: async fn check(& self) -> HealthResponseRuns all health checks.
HealthChecker :: async fn liveness(& self) -> HealthResponseRuns only liveness checks (non-critical checks).
HealthChecker :: async fn readiness(& self) -> HealthResponseRuns readiness checks.
pub struct AlwaysHealthySimple always-healthy check.
AlwaysHealthy :: fn new(name : impl Into <String>) -> SelfCreates a new always-healthy check.
AlwaysHealthy :: fn name(& self) -> & str
AlwaysHealthy :: async fn check(& self) -> CheckResult
pub struct DatabaseCheckDatabase health check.
DatabaseCheck :: fn new <F>(name : impl Into <String>, check_fn : F) -> Self where F : Fn() -> bool + Send + Sync + 'static,Creates a new database check.
DatabaseCheck :: fn name(& self) -> & str
DatabaseCheck :: async fn check(& self) -> CheckResult
pub struct MemoryCheckMemory health check.
MemoryCheck :: fn new(threshold_mb : u64) -> SelfCreates a new memory check with threshold in MB.
MemoryCheck :: fn name(& self) -> & str
MemoryCheck :: async fn check(& self) -> CheckResult
MemoryCheck :: fn is_critical(& self) -> bool
pub struct UptimeCheckUptime check.
UptimeCheck :: fn new() -> SelfCreates a new uptime check.
UptimeCheck :: fn default() -> Self
UptimeCheck :: fn name(& self) -> & str
UptimeCheck :: async fn check(& self) -> CheckResult
UptimeCheck :: fn is_critical(& self) -> bool
pub struct DependencyCheckDependency check for external services.
DependencyCheck :: fn new(name : impl Into <String>, url : impl Into <String>) -> SelfCreates a new dependency check.
DependencyCheck :: fn with_timeout(mut self, timeout : std::time::Duration) -> SelfSets the timeout.
DependencyCheck :: fn name(& self) -> & str
DependencyCheck :: async fn check(& self) -> CheckResult
DependencyCheck :: fn timeout(& self) -> std::time::Duration
pub struct ThresholdConfigThreshold-based check result.
ThresholdConfig :: fn new(warning : f64, critical : f64) -> SelfCreates a new threshold config.
ThresholdConfig :: fn evaluate(& self, value : f64) -> HealthStatusEvaluates a value against thresholds.

No pub use re-exports: every item above is declared in this crate.

Boundary

Depends on no other workspace tier.

Shares tier operations with 40 other crates: operations-approval-workflow, operations-assessments, operations-block-imaging, operations-boot-media, operations-browser-agent-worker, operations-camera-discovery, operations-camera-liveview, operations-camera-registry, … (40 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)operations
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/operations/health
Vocabulary in force (lexicon)current

Dependencies

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
async-trait^0.1noalways
chrono^0.4serdenoalways
serde^1derivenoalways
serde_json^1noalways
thiserror^2noalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
tokio^1fullnoalways

Build. None.

Depended on by. 1 workspace crate.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_application_health["application-health"] -->|uses| SELF
  SELF["operations-health"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
liboperations_health`src/lib.rs`

Error model

Error typeNamed by
HealthErrorResult

Operational characteristics

PropertyEvidence
async public surfaceyes
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

1 workspace crate depends on this one: application-health.

Verification

KindCount
Unit tests23
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root1301

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc4156
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 41
    "No rustdoc detected" : 15

Metrics

MetricValue
Rust source files1
Source lines774
Code lines577
Public API items56
Public modules0
Tests23
Examples0
Cargo features0
Direct runtime dependencies5
Workspace reverse dependencies1
pie showData
    title Public API by kind
    "enum" : 2
    "method" : 43
    "struct" : 9
    "trait" : 1
    "type alias" : 1
pie showData
    title Rust source composition
    "Code" : 577
    "Blank or comment" : 197

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las operations · Manual