From b1bf4fd4d5408c95ef96b0f3247c8ab62f56073d Mon Sep 17 00:00:00 2001 From: Willem Date: Fri, 4 Jul 2025 16:14:47 -0400 Subject: [PATCH] fix: cargo fmt --- examples/rust/src/main.rs | 3 ++- .../modules/application/features/monitoring.rs | 15 ++++++++------- .../alert_channel/discord_alert_channel.rs | 13 ++++++++----- .../monitoring/alert_channel/webhook_receiver.rs | 13 ++++++++----- .../monitoring/application_monitoring/mod.rs | 2 -- .../monitoring/grafana/helm/helm_grafana.rs | 5 +++-- .../src/modules/monitoring/grafana/helm/mod.rs | 1 - harmony/src/modules/monitoring/mod.rs | 4 ++-- .../src/modules/monitoring/prometheus/helm/mod.rs | 1 - 9 files changed, 31 insertions(+), 26 deletions(-) diff --git a/examples/rust/src/main.rs b/examples/rust/src/main.rs index 49f90d7..15d56d4 100644 --- a/examples/rust/src/main.rs +++ b/examples/rust/src/main.rs @@ -4,7 +4,8 @@ use harmony::{ inventory::Inventory, maestro::Maestro, modules::application::{ - features::{ContinuousDelivery, Monitoring}, ApplicationScore, RustWebFramework, RustWebapp + ApplicationScore, RustWebFramework, RustWebapp, + features::{ContinuousDelivery, Monitoring}, }, topology::{K8sAnywhereTopology, Url}, }; diff --git a/harmony/src/modules/application/features/monitoring.rs b/harmony/src/modules/application/features/monitoring.rs index 0cd61bd..0a8d421 100644 --- a/harmony/src/modules/application/features/monitoring.rs +++ b/harmony/src/modules/application/features/monitoring.rs @@ -1,4 +1,3 @@ - use async_trait::async_trait; use log::info; @@ -6,19 +5,21 @@ use crate::{ inventory::Inventory, modules::{ application::{Application, ApplicationFeature}, - monitoring::{application_monitoring::k8s_application_monitoring_score::ApplicationPrometheusMonitoringScore, kube_prometheus::{ - helm_prometheus_alert_score::HelmPrometheusAlertingScore, - types::{NamespaceSelector, ServiceMonitor}, - }}, + monitoring::{ + application_monitoring::k8s_application_monitoring_score::ApplicationPrometheusMonitoringScore, + kube_prometheus::{ + helm_prometheus_alert_score::HelmPrometheusAlertingScore, + types::{NamespaceSelector, ServiceMonitor}, + }, + }, }, score::Score, - topology::{tenant::TenantManager, HelmCommand, Topology}, + topology::{HelmCommand, Topology, tenant::TenantManager}, }; #[derive(Debug, Default, Clone)] pub struct Monitoring {} - #[async_trait] impl ApplicationFeature for Monitoring { async fn ensure_installed(&self, topology: &T) -> Result<(), String> { diff --git a/harmony/src/modules/monitoring/alert_channel/discord_alert_channel.rs b/harmony/src/modules/monitoring/alert_channel/discord_alert_channel.rs index cb3d0db..be8f0e3 100644 --- a/harmony/src/modules/monitoring/alert_channel/discord_alert_channel.rs +++ b/harmony/src/modules/monitoring/alert_channel/discord_alert_channel.rs @@ -4,11 +4,14 @@ use serde_yaml::{Mapping, Value}; use crate::{ interpret::{InterpretError, Outcome}, - modules::monitoring::{kube_prometheus::{ - prometheus::{KubePrometheus, KubePrometheusReceiver}, - types::{AlertChannelConfig, AlertManagerChannelConfig}, - }, prometheus::prometheus::{Prometheus, PrometheusReceiver}}, - topology::{oberservability::monitoring::AlertReceiver, Url}, + modules::monitoring::{ + kube_prometheus::{ + prometheus::{KubePrometheus, KubePrometheusReceiver}, + types::{AlertChannelConfig, AlertManagerChannelConfig}, + }, + prometheus::prometheus::{Prometheus, PrometheusReceiver}, + }, + topology::{Url, oberservability::monitoring::AlertReceiver}, }; #[derive(Debug, Clone, Serialize)] diff --git a/harmony/src/modules/monitoring/alert_channel/webhook_receiver.rs b/harmony/src/modules/monitoring/alert_channel/webhook_receiver.rs index bb2415f..f844431 100644 --- a/harmony/src/modules/monitoring/alert_channel/webhook_receiver.rs +++ b/harmony/src/modules/monitoring/alert_channel/webhook_receiver.rs @@ -4,11 +4,14 @@ use serde_yaml::{Mapping, Value}; use crate::{ interpret::{InterpretError, Outcome}, - modules::monitoring::{kube_prometheus::{ - prometheus::{KubePrometheus, KubePrometheusReceiver}, - types::{AlertChannelConfig, AlertManagerChannelConfig}, - }, prometheus::prometheus::{Prometheus, PrometheusReceiver}}, - topology::{oberservability::monitoring::AlertReceiver, Url}, + modules::monitoring::{ + kube_prometheus::{ + prometheus::{KubePrometheus, KubePrometheusReceiver}, + types::{AlertChannelConfig, AlertManagerChannelConfig}, + }, + prometheus::prometheus::{Prometheus, PrometheusReceiver}, + }, + topology::{Url, oberservability::monitoring::AlertReceiver}, }; #[derive(Debug, Clone, Serialize)] diff --git a/harmony/src/modules/monitoring/application_monitoring/mod.rs b/harmony/src/modules/monitoring/application_monitoring/mod.rs index f6154da..d9a313b 100644 --- a/harmony/src/modules/monitoring/application_monitoring/mod.rs +++ b/harmony/src/modules/monitoring/application_monitoring/mod.rs @@ -1,3 +1 @@ - pub mod k8s_application_monitoring_score; - diff --git a/harmony/src/modules/monitoring/grafana/helm/helm_grafana.rs b/harmony/src/modules/monitoring/grafana/helm/helm_grafana.rs index 8df2b54..c53fe3f 100644 --- a/harmony/src/modules/monitoring/grafana/helm/helm_grafana.rs +++ b/harmony/src/modules/monitoring/grafana/helm/helm_grafana.rs @@ -4,14 +4,15 @@ use std::str::FromStr; use crate::modules::helm::chart::HelmChartScore; pub fn grafana_helm_chart_score(ns: &str) -> HelmChartScore { - let values = format!( + let values = format!( r#" rbac: namespaced: true sidecar: dashboards: enabled: true - "#); + "# + ); HelmChartScore { namespace: Some(NonBlankString::from_str(ns).unwrap()), diff --git a/harmony/src/modules/monitoring/grafana/helm/mod.rs b/harmony/src/modules/monitoring/grafana/helm/mod.rs index 6a93df6..1d35fdf 100644 --- a/harmony/src/modules/monitoring/grafana/helm/mod.rs +++ b/harmony/src/modules/monitoring/grafana/helm/mod.rs @@ -1,2 +1 @@ pub mod helm_grafana; - diff --git a/harmony/src/modules/monitoring/mod.rs b/harmony/src/modules/monitoring/mod.rs index 047a3a5..b93f0c6 100644 --- a/harmony/src/modules/monitoring/mod.rs +++ b/harmony/src/modules/monitoring/mod.rs @@ -1,7 +1,7 @@ pub mod alert_channel; pub mod alert_rule; +pub mod application_monitoring; +pub mod grafana; pub mod kube_prometheus; pub mod ntfy; -pub mod grafana; pub mod prometheus; -pub mod application_monitoring; diff --git a/harmony/src/modules/monitoring/prometheus/helm/mod.rs b/harmony/src/modules/monitoring/prometheus/helm/mod.rs index 6470377..431fc6c 100644 --- a/harmony/src/modules/monitoring/prometheus/helm/mod.rs +++ b/harmony/src/modules/monitoring/prometheus/helm/mod.rs @@ -1,2 +1 @@ pub mod prometheus_helm; -