Monitor an application within a tenant #86
@ -72,17 +72,6 @@ impl K8sclient for K8sAnywhereTopology {
|
||||
|
||||
#[async_trait]
|
||||
impl PrometheusApplicationMonitoring<CRDPrometheus> for K8sAnywhereTopology {
|
||||
async fn configure_receivers(
|
||||
&self,
|
||||
receivers: Option<Vec<Box<dyn AlertReceiver<CRDPrometheus>>>>,
|
||||
) -> Option<Vec<Box<dyn CRDAlertManagerReceiver>>> {
|
||||
let Some(receivers) = receivers else {
|
||||
return None;
|
||||
};
|
||||
|
||||
todo!()
|
||||
}
|
||||
|
||||
async fn install_prometheus(
|
||||
&self,
|
||||
sender: &CRDPrometheus,
|
||||
@ -141,7 +130,7 @@ impl K8sAnywhereTopology {
|
||||
receivers: self
|
||||
.configure_receivers(receivers)
|
||||
.await
|
||||
.unwrap_or_else(|| vec![]),
|
||||
.unwrap_or_else(Vec::new),
|
||||
service_monitors: vec![],
|
||||
prometheus_rules: vec![],
|
||||
}
|
||||
@ -319,6 +308,17 @@ impl K8sAnywhereTopology {
|
||||
"prometheus operator present in cluster".to_string(),
|
||||
))
|
||||
}
|
||||
|
||||
async fn configure_receivers(
|
||||
&self,
|
||||
receivers: Option<Vec<Box<dyn AlertReceiver<CRDPrometheus>>>>,
|
||||
) -> Option<Vec<Box<dyn CRDAlertManagerReceiver>>> {
|
||||
let Some(receivers) = receivers else {
|
||||
return None;
|
||||
};
|
||||
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -564,7 +564,7 @@ impl K8sPrometheusCRDAlertingInterpret {
|
||||
) -> Result<Outcome, InterpretError> {
|
||||
for receiver in receivers.iter() {
|
||||
let alertmanager_config: AlertmanagerConfig = receiver
|
||||
.configure_receiver(&client, self.sender.namespace.clone().clone())
|
||||
.configure_receiver(client, self.sender.namespace.clone())
|
||||
.await;
|
||||
let sender = CRDPrometheus {
|
||||
alertmanager_configs: alertmanager_config,
|
||||
@ -575,6 +575,6 @@ impl K8sPrometheusCRDAlertingInterpret {
|
||||
InterpretError::new(format!("failed to install receiver: {}", err))
|
||||
})?;
|
||||
}
|
||||
Ok(Outcome::success(format!("successfully deployed receivers")))
|
||||
Ok(Outcome::success("successfully deployed receivers".into()))
|
||||
}
|
||||
}
|
||||
|
@ -3,16 +3,11 @@ use async_trait::async_trait;
|
||||
use crate::{
|
||||
interpret::{InterpretError, Outcome},
|
||||
inventory::Inventory,
|
||||
modules::monitoring::kube_prometheus::crd::crd_alertmanager_config::CRDAlertManagerReceiver,
|
||||
topology::oberservability::monitoring::{AlertReceiver, AlertSender},
|
||||
};
|
||||
|
||||
#[async_trait]
|
||||
pub trait PrometheusApplicationMonitoring<S: AlertSender> {
|
||||
async fn configure_receivers(
|
||||
&self,
|
||||
receivers: Option<Vec<Box<dyn AlertReceiver<S>>>>,
|
||||
) -> Option<Vec<Box<dyn CRDAlertManagerReceiver>>>;
|
||||
async fn install_prometheus(
|
||||
|
||||
&self,
|
||||
sender: &S,
|
||||
|
Loading…
Reference in New Issue
Block a user
install_prometheus
seems a bit inaccurate: we're not installing prometheus here, we're installing the receivers to run on prometheusmaybe should be renamed to
install_receivers
orinstall_monitoring
or something similar