File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ pub mod rule;
24
24
pub mod target;
25
25
26
26
use crate :: metrics:: ALERTS_STATES ;
27
- use crate :: utils:: uid:: Uid ;
27
+ use crate :: storage;
28
+ use crate :: utils:: uid;
28
29
29
30
pub use self :: rule:: Rule ;
30
31
use self :: target:: Target ;
@@ -39,7 +40,7 @@ pub struct Alerts {
39
40
#[ serde( rename_all = "camelCase" ) ]
40
41
pub struct Alert {
41
42
#[ serde( default = "crate::utils::uid::gen" ) ]
42
- pub id : Uid ,
43
+ pub id : uid :: Uid ,
43
44
pub name : String ,
44
45
pub message : String ,
45
46
pub rule : Rule ,
@@ -69,12 +70,14 @@ impl Alert {
69
70
}
70
71
71
72
fn get_context ( & self , stream_name : String , alert_state : AlertState ) -> Context {
73
+ let deployment_id = storage:: StorageMetadata :: global ( ) . deployment_id ;
72
74
Context :: new (
73
75
stream_name,
74
76
self . name . clone ( ) ,
75
77
self . message . clone ( ) ,
76
78
self . rule . trigger_reason ( ) ,
77
79
alert_state,
80
+ deployment_id,
78
81
)
79
82
}
80
83
}
@@ -90,6 +93,7 @@ pub struct Context {
90
93
message : String ,
91
94
reason : String ,
92
95
alert_state : AlertState ,
96
+ deployment_id : uid:: Uid ,
93
97
}
94
98
95
99
impl Context {
@@ -99,13 +103,15 @@ impl Context {
99
103
message : String ,
100
104
reason : String ,
101
105
alert_state : AlertState ,
106
+ deployment_id : uid:: Uid ,
102
107
) -> Self {
103
108
Self {
104
109
stream,
105
110
alert_name,
106
111
message,
107
112
reason,
108
113
alert_state,
114
+ deployment_id,
109
115
}
110
116
}
111
117
Original file line number Diff line number Diff line change @@ -317,6 +317,7 @@ impl CallableTarget for AlertManager {
317
317
"labels" : {
318
318
"alertname" : payload. alert_name,
319
319
"stream" : payload. stream,
320
+ "deployment_id" : payload. deployment_id
320
321
} ,
321
322
"annotations" : {
322
323
"message" : payload. message,
You can’t perform that action at this time.
0 commit comments