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 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)]
@ -10,12 +14,60 @@ pub struct MonitoringAlertingStackScore {
}
impl<T: Topology> Score<T> for MonitoringAlertingStackScore {
fn create_interpret(&self) -> Box<dyn Interpret<T>> {
todo!()
Box::new(MonitoringAlertingStackInterpret {
score: self.clone(),
Outdated
Review

Why does the MonitoringAlertingStackScore need a Vec<Box<dyn Score<MonitoringAlertingTopology>>>? It seems like it's never used for anything.

A score's variables should be what is needed to set it up, i.e. any values, rules, etc you want to pass in for the interpret to use to spin up the score

Why does the `MonitoringAlertingStackScore` need a `Vec<Box<dyn Score<MonitoringAlertingTopology>>>`? It seems like it's never used for anything. A score's variables should be what is needed to set it up, i.e. any values, rules, etc you want to pass in for the interpret to use to spin up the score
})
}
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!()
}
}

View File

@ -9,10 +9,11 @@ use crate::modules::helm::chart::HelmChartScore;
pub fn kube_prometheus_score(ns: &str) -> HelmChartScore {
HelmChartScore {
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(
todo!() //use kube prometheus chart which includes grafana, prometheus, alert
//manager, etc
"https://prometheus-community.github.io/helm-charts"
//use kube prometheus chart which includes grafana, prometheus, alert
//manager, etc
)
.unwrap(),
chart_version: None,