From a90c3cb3a1c7e4531cdb246c98947c469a2c3c1b Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Fri, 26 Nov 2021 10:29:15 -0700 Subject: [PATCH] adds name, description; changes critical boolean to severity enum (#855) --- appmgr/src/status/health_check.rs | 11 ++++++++++- appmgr/src/status/mod.rs | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/appmgr/src/status/health_check.rs b/appmgr/src/status/health_check.rs index ae53b81b7..0dbe59c68 100644 --- a/appmgr/src/status/health_check.rs +++ b/appmgr/src/status/health_check.rs @@ -67,11 +67,20 @@ impl HealthChecks { } } +#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] +#[serde(rename_all = "kebab-case")] +pub enum HealthCheckSeverity { + Warning, + Critical, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct HealthCheck { + pub name: String, + pub description: String, #[serde(flatten)] implementation: ActionImplementation, - pub critical: bool, + pub severity: HealthCheckSeverity, pub timeout: Option, } impl HealthCheck { diff --git a/appmgr/src/status/mod.rs b/appmgr/src/status/mod.rs index 7600cfb8b..b5c0cb75f 100644 --- a/appmgr/src/status/mod.rs +++ b/appmgr/src/status/mod.rs @@ -5,7 +5,7 @@ use patch_db::{DbHandle, HasModel}; use serde::{Deserialize, Serialize}; use tracing::instrument; -use self::health_check::HealthCheckId; +use self::health_check::{HealthCheckId, HealthCheckSeverity}; use crate::context::RpcContext; use crate::dependencies::DependencyErrors; use crate::notifications::NotificationLevel; @@ -67,7 +67,7 @@ impl MainStatus { .health_checks .0 .get(check) - .map(|hc| hc.critical) + .map(|hc| hc.severity == HealthCheckSeverity::Critical) .unwrap_or_default() => { ctx.notification_manager.notify(