@@ -76,7 +76,7 @@ func newRestApi(ctx context.Context) http.Handler {
76
76
handleDeadMansSwitchCheckin (w , r , alertmanagertypes.DeadMansSwitchCheckinRequest {
77
77
Subject : r .URL .Query ().Get ("subject" ),
78
78
TTL : r .URL .Query ().Get ("ttl" ),
79
- })
79
+ }, app )
80
80
})
81
81
82
82
mux .POST .HandleFunc ("/deadmansswitch/checkin" , func (w http.ResponseWriter , r * http.Request ) {
@@ -87,7 +87,7 @@ func newRestApi(ctx context.Context) http.Handler {
87
87
}
88
88
89
89
// handles validation
90
- handleDeadMansSwitchCheckin (w , r , checkin )
90
+ handleDeadMansSwitchCheckin (w , r , checkin , app )
91
91
})
92
92
93
93
mux .POST .HandleFunc ("/prometheus-alertmanager/api/v1/alerts" , func (w http.ResponseWriter , r * http.Request ) {
@@ -97,11 +97,12 @@ func newRestApi(ctx context.Context) http.Handler {
97
97
return mux
98
98
}
99
99
100
- func handleDeadMansSwitchCheckin (
101
- w http.ResponseWriter ,
102
- r * http.Request ,
103
- raw alertmanagertypes.DeadMansSwitchCheckinRequest ,
104
- ) {
100
+ func handleDeadMansSwitchCheckin (
101
+ w http.ResponseWriter ,
102
+ r * http.Request ,
103
+ raw alertmanagertypes.DeadMansSwitchCheckinRequest ,
104
+ app * amstate.App ,
105
+ ) {
105
106
if raw .Subject == "" || raw .TTL == "" {
106
107
http .Error (w , "subject or ttl empty" , http .StatusBadRequest )
107
108
return
@@ -115,7 +116,7 @@ func newRestApi(ctx context.Context) http.Handler {
115
116
return
116
117
}
117
118
118
- alertAcked , err := deadmansswitchCheckin (r .Context (), raw .Subject , ttl )
119
+ alertAcked , err := deadmansswitchCheckin (r .Context (), raw .Subject , ttl , app )
119
120
if err != nil {
120
121
http .Error (w , err .Error (), http .StatusInternalServerError )
121
122
return
0 commit comments