monitoring-alerting #30

Merged
wjro merged 12 commits from monitoring-alerting into master 2025-05-06 17:50:57 +00:00
2 changed files with 59 additions and 6 deletions
Showing only changes of commit a6bcaade46 - Show all commits

View File

@ -1,7 +1,11 @@
use serde::Serialize; use serde::Serialize;
use crate::{ use crate::{
interpret::Interpret, maestro::Maestro, modules::helm::chart::HelmChartScore, score::Score, topology::{K8sclient, Topology} interpret::Interpret,
maestro::Maestro,
modules::helm::chart::HelmChartScore,
score::Score,
topology::{K8sclient, Topology},
}; };
#[derive(Debug, Clone, Serialize)] #[derive(Debug, Clone, Serialize)]
@ -10,12 +14,60 @@ pub struct MonitoringAlertingStackScore {
} }
impl<T: Topology> Score<T> for MonitoringAlertingStackScore { impl<T: Topology> Score<T> for MonitoringAlertingStackScore {
fn create_interpret(&self) -> Box<dyn Interpret<T>> { fn create_interpret(&self) -> Box<dyn Interpret<T>> {
todo!() Box::new(MonitoringAlertingStackInterpret {
score: self.clone(),
})
} }
fn name(&self) -> String { fn name(&self) -> String {
format!(
"{} {} MonitoringAlertingStackScore",
self.monitoring.chart_name, self.monitoring.release_name
)
}
}
#[derive(Debug, Serialize)]
struct MonitoringAlertingStackInterpret {
pub score: MonitoringAlertingStackScore,
}
#[async_trait]
impl<T: Topology> Interpret<T> for MonitoringAlertingStackInterpret {
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
inventory: &'life1 Inventory,
topology: &'life2 T,
) -> ::core::pin::Pin<
Box<
dyn ::core::future::Future<Output = Result<Outcome, InterpretError>>
+ ::core::marker::Send
+ 'async_trait,
>,
>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
{
todo!()
}
fn get_name(&self) -> InterpretName {
todo!()
}
fn get_version(&self) -> Version {
todo!()
}
fn get_status(&self) -> InterpretStatus {
todo!()
}
fn get_children(&self) -> Vec<Id> {
todo!() todo!()
} }
} }

View File

@ -9,10 +9,11 @@ use crate::modules::helm::chart::HelmChartScore;
pub fn kube_prometheus_score(ns: &str) -> HelmChartScore { pub fn kube_prometheus_score(ns: &str) -> HelmChartScore {
HelmChartScore { HelmChartScore {
namespace: Some(NonBlankString::from_str(ns).unwrap()), namespace: Some(NonBlankString::from_str(ns).unwrap()),
release_name: NonBlankString::from_str("es").unwrap(), release_name: NonBlankString::from_str("kube-prometheus").unwrap(),
chart_name: NonBlankString::from_str( chart_name: NonBlankString::from_str(
todo!() //use kube prometheus chart which includes grafana, prometheus, alert "https://prometheus-community.github.io/helm-charts"
//manager, etc //use kube prometheus chart which includes grafana, prometheus, alert
//manager, etc
) )
.unwrap(), .unwrap(),
chart_version: None, chart_version: None,