#[derive(HealthCheck)]
{
// Attributes available to this derive:
#[health]
}
Available on crate feature
di only.Expand description
Re-export HealthCheck derive macro for automatic health check implementation Derive macro for automatic HealthCheck implementation
Generates the HealthCheck trait implementation by collecting all fields
that implement the Dependency trait.
§Example
ⓘ
use allframe_macros::HealthCheck;
use allframe_core::health::{Dependency, DependencyStatus};
struct RedisDependency { /* ... */ }
impl Dependency for RedisDependency { /* ... */ }
struct DatabaseDependency { /* ... */ }
impl Dependency for DatabaseDependency { /* ... */ }
#[derive(HealthCheck)]
struct AppHealth {
#[health(timeout = "5s", critical = true)]
redis: RedisDependency,
#[health(timeout = "10s", critical = false)]
database: DatabaseDependency,
#[health(skip)]
config: Config, // Not a dependency
}
// Auto-generates:
// impl HealthCheck for AppHealth { ... }§Attributes
#[health(skip)]- Skip this field from health checks#[health(critical = true)]- Mark dependency as critical (default: true)#[health(timeout = "5s")]- Set check timeout (default: 5s)