Skip to content

Commit 29174ea

Browse files
authored
add new alerts spec and fix alertmanager integration (#307)
1 parent c15cdd1 commit 29174ea

File tree

9 files changed

+226
-152
lines changed

9 files changed

+226
-152
lines changed

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ os_info = "3.6"
4848
hostname = "0.3"
4949
rand = "0.8"
5050
relative-path = { version = "1.7", features = ["serde"] }
51+
reqwest = { version = "0.11", default_features=false, features=["rustls", "json", "hyper-rustls", "tokio-rustls"]}
5152
rustls = "0.20"
5253
rustls-pemfile = "1.0"
5354
rust-flatten-json = "0.2"
@@ -66,7 +67,6 @@ clokwerk = "0.4"
6667
actix-web-static-files = "4.0"
6768
static-files = "0.2"
6869
ulid = { version = "1.0", features = ["serde"] }
69-
ureq = { version = "2.6", features = ["json"] }
7070
hex = "0.4"
7171
itertools = "0.10"
7272
xxhash-rust = { version = "0.8", features = ["xxh3"] }

server/src/alerts/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*
1717
*/
1818

19+
use async_trait::async_trait;
1920
use serde::{Deserialize, Serialize};
2021
use std::fmt;
2122

@@ -77,9 +78,9 @@ impl Alert {
7778
)
7879
}
7980
}
80-
81+
#[async_trait]
8182
pub trait CallableTarget {
82-
fn call(&self, payload: &Context);
83+
async fn call(&self, payload: &Context);
8384
}
8485

8586
#[derive(Debug, Clone)]

server/src/alerts/rule.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ impl ColumnRule {
113113
}) => format!(
114114
"{} column was {} {}, {} times",
115115
column,
116-
value,
117116
match operator {
118117
NumericOperator::EqualTo => "equal to",
119118
NumericOperator::NotEqualTo => " not equal to",
@@ -122,6 +121,7 @@ impl ColumnRule {
122121
NumericOperator::LessThan => "less than",
123122
NumericOperator::LessThanEquals => "less than or equal to",
124123
},
124+
value,
125125
repeats
126126
),
127127
Self::ConsecutiveString(ConsecutiveStringRule {
@@ -137,13 +137,13 @@ impl ColumnRule {
137137
}) => format!(
138138
"{} column {} {}, {} times",
139139
column,
140-
value,
141140
match operator {
142141
StringOperator::Exact => "was equal to",
143142
StringOperator::NotExact => "was not equal to",
144143
StringOperator::Contains => "contained",
145144
StringOperator::NotContains => "did not contain",
146145
},
146+
value,
147147
repeats
148148
),
149149
}

0 commit comments

Comments
 (0)