feat: Initial setup for monitoring and alerting #48
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/monitor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@@ -265,1 +266,4 @@}#[async_trait]impl NotificationAdapterDeployer for K8sAnywhereTopology {I feel like this is not a correct abstraction. NotificationAdapter has a responsibility and Deployer has another. This is a strong smell of broken Single Responsibility principle, probably interface segregation too.
@@ -0,0 +3,4 @@pub mod monitoring;pub mod notification_adapter_deployer;pub enum MonitoringBackendType {Violates OCP : we want to allow external contributors to provide new backend implementations (that is, if we want to introduce the concept of monitoring backend right now or wait until the needs arises?)
@@ -0,0 +31,4 @@monitor_config: &MonitorConfig,) -> Result<Outcome, InterpretError>;async fn ensure_alert_channel_dependencies(SRP problem
@@ -0,0 +50,4 @@}}pub trait AlertChannelConfig: Debug + DynClone + Send + Sync {I think we can solve the dependency issue by introducing a T here :
@@ -0,0 +9,4 @@use crate::{interpret::Outcome, topology::Topology};#[async_trait]pub trait Monitor<T: Topology>: Debug + Send + Sync {A bit of rustdoc would be relevant here to explain the intended use of this trait.
@@ -0,0 +24,4 @@}#[async_trait]pub trait AlertChannelConfig<T>: Debug + DynClone + Send + Sync {I think this trait is correct but the way it is implemented feels wrong. I understand that you currently only have the discord implementation and you interact directly with it. But I feel like there will be a use case where we will want to have simple getter and setters for common attributes of AlertChannelConfig. I don't see a 100% clear use case right now though.
Food for thought.
Which makes me think : is this trait required at all? Probably not. Each AlertChannel implementation will have its own config and either the Monitor or AlertChannel trait will provide standardization for identification and compilation safety. But it is probably not necessary to try to expose a config specific trait.
@@ -0,0 +27,4 @@pub trait AlertChannelConfig<T>: Debug + DynClone + Send + Sync {fn channel_identifier(&self) -> String;fn webhook_url(&self) -> Option<Url>;I don't think webhook url deserves to be in this abstract trait. It is possible that the AlertChannel does not have a webhook, such as SMS, phone calls, SMTP.
@@ -0,0 +26,4 @@}#[async_trait]impl<T: Topology + DiscordWebhookSender> AlertChannelConfig<T> for DiscordWebhookConfig {You don't have to specify Topology here. I think it's better to keep the trait bindings to the minimum. DiscordWebhookSender should be enough.
@@ -0,0 +40,4 @@}#[async_trait]impl DiscordWebhookSender for K8sAnywhereTopology {Nice 👍
We probably will have to add a mechanism for Topologies so that dependencies can register their installation mechanisms themselves to make sure they are initialized properly when maestro initializes the topology. But that should not be too hard and is out of scope of this p-r.
@@ -0,0 +10,4 @@/// Represents an entity responsible for collecting and organizing observability data/// from various telemetry sources/// A `Monitor` abstracts the logic required to scrape, aggregate, and structure/// monitoring data, enabling consistent processing regardless of the underlying data source.This rustdoc is pretty good to explain the abstraction, but giving a concrete example such as Prometheus would make a complete understanding much easier. Even I still have a bit of trouble to figure it out as-is.