remove unnecessary configure_receivers method from trait
This commit is contained in:
parent
961a300154
commit
4b6bebcaf1
@ -72,17 +72,6 @@ impl K8sclient for K8sAnywhereTopology {
|
|||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl PrometheusApplicationMonitoring<CRDPrometheus> for K8sAnywhereTopology {
|
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(
|
async fn install_prometheus(
|
||||||
&self,
|
&self,
|
||||||
sender: &CRDPrometheus,
|
sender: &CRDPrometheus,
|
||||||
@ -141,7 +130,7 @@ impl K8sAnywhereTopology {
|
|||||||
receivers: self
|
receivers: self
|
||||||
.configure_receivers(receivers)
|
.configure_receivers(receivers)
|
||||||
.await
|
.await
|
||||||
.unwrap_or_else(|| vec![]),
|
.unwrap_or_else(Vec::new),
|
||||||
service_monitors: vec![],
|
service_monitors: vec![],
|
||||||
prometheus_rules: vec![],
|
prometheus_rules: vec![],
|
||||||
}
|
}
|
||||||
@ -319,6 +308,17 @@ impl K8sAnywhereTopology {
|
|||||||
"prometheus operator present in cluster".to_string(),
|
"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)]
|
#[derive(Clone, Debug)]
|
||||||
|
|||||||
@ -564,7 +564,7 @@ impl K8sPrometheusCRDAlertingInterpret {
|
|||||||
) -> Result<Outcome, InterpretError> {
|
) -> Result<Outcome, InterpretError> {
|
||||||
for receiver in receivers.iter() {
|
for receiver in receivers.iter() {
|
||||||
let alertmanager_config: AlertmanagerConfig = receiver
|
let alertmanager_config: AlertmanagerConfig = receiver
|
||||||
.configure_receiver(&client, self.sender.namespace.clone().clone())
|
.configure_receiver(client, self.sender.namespace.clone())
|
||||||
.await;
|
.await;
|
||||||
let sender = CRDPrometheus {
|
let sender = CRDPrometheus {
|
||||||
alertmanager_configs: alertmanager_config,
|
alertmanager_configs: alertmanager_config,
|
||||||
@ -575,6 +575,6 @@ impl K8sPrometheusCRDAlertingInterpret {
|
|||||||
InterpretError::new(format!("failed to install receiver: {}", err))
|
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::{
|
use crate::{
|
||||||
interpret::{InterpretError, Outcome},
|
interpret::{InterpretError, Outcome},
|
||||||
inventory::Inventory,
|
inventory::Inventory,
|
||||||
modules::monitoring::kube_prometheus::crd::crd_alertmanager_config::CRDAlertManagerReceiver,
|
|
||||||
topology::oberservability::monitoring::{AlertReceiver, AlertSender},
|
topology::oberservability::monitoring::{AlertReceiver, AlertSender},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait PrometheusApplicationMonitoring<S: AlertSender> {
|
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(
|
async fn install_prometheus(
|
||||||
&self,
|
&self,
|
||||||
sender: &S,
|
sender: &S,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user