feat:added Slack notifications support #38

Merged
wjro merged 2 commits from feat/slack-notifs into master 2025-05-22 20:04:52 +00:00
Owner
No description provided.
wjro added 1 commit 2025-05-21 23:33:29 +00:00
wjro added 1 commit 2025-05-22 18:16:49 +00:00
johnride approved these changes 2025-05-22 20:01:14 +00:00
johnride left a comment
Owner

Overall seems OK. Deserves some refactoring though.

Overall seems OK. Deserves some refactoring though.
@ -13,2 +9,2 @@
"None".to_string()
};
fn get_discord_alert_manager_score(config: &KubePrometheusConfig) -> Option<HelmChartScore> {
let (url, name) = config.alert_channel.iter().find_map(|channel| {
Owner

Since we're supporting a list, shouldn't we use filter_map instead so we can handle all the instances at once?

Also this is a smell to me. All the handlers should implement the same trait. For example :

trait AlertEndpoint {
  fn register(&self, ...);
}

Ce serait une facon de simplifier la gestion de chacun des types ensuite. C'est plus type safe et moins error prone.

Since we're supporting a list, shouldn't we use filter_map instead so we can handle all the instances at once? Also this is a smell to me. All the handlers should implement the same trait. For example : ``` trait AlertEndpoint { fn register(&self, ...); } ``` Ce serait une facon de simplifier la gestion de chacun des types ensuite. C'est plus type safe et moins error prone.
@ -188,2 +221,4 @@
}
}
fn discord_alert_builder(release_name: &String) -> (String, String) {
Owner

Yeah, these two functions here discord_alert_builder and slack_alert_builder here should be implementations of a trait.

The fact that their names share the same semantics is a great givaway.

Also, returning (String, String) is pretty weak. I guess there should be a type or you should build a custom type for that. Then this type can Derive Serialize.

Yeah, these two functions here `discord_alert_builder` and `slack_alert_builder` here should be implementations of a trait. The fact that their names share the same semantics is a great givaway. Also, returning (String, String) is pretty weak. I guess there should be a type or you should build a custom type for that. Then this type can Derive Serialize.
wjro merged commit 9c51040f3b into master 2025-05-22 20:04:52 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: NationTech/harmony#38
No description provided.