fix:cargo fmt
All checks were successful
Run Check Script / check (push) Successful in 1m45s
Run Check Script / check (pull_request) Successful in 1m45s

This commit is contained in:
Willem 2025-05-30 13:59:29 -04:00
parent b631e8ccbb
commit 7e3f1b1830
4 changed files with 22 additions and 20 deletions

View File

@ -15,9 +15,12 @@ use crate::{
}; };
use super::{ use super::{
k8s::K8sClient, oberservability::notification_adapter_deployer::NotificationAdapterDeployer, tenant::{ HelmCommand, K8sclient, Topology,
k8s::K8sTenantManager, ResourceLimits, TenantConfig, TenantManager, TenantNetworkPolicy k8s::K8sClient,
}, HelmCommand, K8sclient, Topology oberservability::notification_adapter_deployer::NotificationAdapterDeployer,
tenant::{
ResourceLimits, TenantConfig, TenantManager, TenantNetworkPolicy, k8s::K8sTenantManager,
},
}; };
struct K8sState { struct K8sState {

View File

@ -3,8 +3,8 @@ mod host_binding;
mod http; mod http;
mod k8s_anywhere; mod k8s_anywhere;
mod localhost; mod localhost;
pub mod tenant;
pub mod oberservability; pub mod oberservability;
pub mod tenant;
pub use k8s_anywhere::*; pub use k8s_anywhere::*;
pub use localhost::*; pub use localhost::*;
pub mod k8s; pub mod k8s;

View File

@ -11,6 +11,3 @@ pub struct MonitorConfig {
pub backend: MonitoringBackendType, pub backend: MonitoringBackendType,
pub alert_channels: Vec<Box<dyn AlertChannelConfig>>, pub alert_channels: Vec<Box<dyn AlertChannelConfig>>,
} }

View File

@ -1,15 +1,12 @@
use async_trait::async_trait; use async_trait::async_trait;
use std::fmt::Debug;
use dyn_clone::DynClone; use dyn_clone::DynClone;
use serde_json::Value; use serde_json::Value;
use std::fmt::Debug;
use crate::interpret::InterpretError; use crate::interpret::InterpretError;
use crate::{ use crate::{interpret::Outcome, topology::Topology};
interpret::Outcome,
topology::Topology,
};
use super::notification_adapter_deployer::NotificationAdapterDeployer; use super::notification_adapter_deployer::NotificationAdapterDeployer;
use super::{MonitorConfig, MonitoringBackendType}; use super::{MonitorConfig, MonitoringBackendType};
@ -43,18 +40,23 @@ pub trait Monitor<T: Topology + NotificationAdapterDeployer> {
if let Some(notification_adapter_id) = if let Some(notification_adapter_id) =
channel.requires_external_alert_channel_adapter(&monitor_config.backend) channel.requires_external_alert_channel_adapter(&monitor_config.backend)
{ {
topology.deploy_notification_adapter( topology.deploy_notification_adapter(&notification_adapter_id.as_ref())?;
&notification_adapter_id.as_ref(),
)?;
} }
} }
Ok(Outcome::success(format!("deployed alert channels {:?}", &monitor_config.alert_channels))) Ok(Outcome::success(format!(
"deployed alert channels {:?}",
&monitor_config.alert_channels
)))
} }
} }
pub trait AlertChannelConfig: Debug + DynClone + Send + Sync { pub trait AlertChannelConfig: Debug + DynClone + Send + Sync {
fn build_backend_integration_config(&self, backend: &MonitoringBackendType) -> Result<Value, InterpretError>; fn build_backend_integration_config(
fn requires_external_alert_channel_adapter(&self, backend: &MonitoringBackendType) -> Option<String>; &self,
backend: &MonitoringBackendType,
) -> Result<Value, InterpretError>;
fn requires_external_alert_channel_adapter(
&self,
backend: &MonitoringBackendType,
) -> Option<String>;
} }