@@ -76,7 +76,7 @@ func newRestApi(ctx context.Context) http.Handler {
7676 handleDeadMansSwitchCheckin (w , r , alertmanagertypes.DeadMansSwitchCheckinRequest {
7777 Subject : r .URL .Query ().Get ("subject" ),
7878 TTL : r .URL .Query ().Get ("ttl" ),
79- })
79+ }, app )
8080 })
8181
8282 mux .POST .HandleFunc ("/deadmansswitch/checkin" , func (w http.ResponseWriter , r * http.Request ) {
@@ -87,7 +87,7 @@ func newRestApi(ctx context.Context) http.Handler {
8787 }
8888
8989 // handles validation
90- handleDeadMansSwitchCheckin (w , r , checkin )
90+ handleDeadMansSwitchCheckin (w , r , checkin , app )
9191 })
9292
9393 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 {
9797 return mux
9898}
9999
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+ ) {
105106 if raw .Subject == "" || raw .TTL == "" {
106107 http .Error (w , "subject or ttl empty" , http .StatusBadRequest )
107108 return
@@ -115,7 +116,7 @@ func newRestApi(ctx context.Context) http.Handler {
115116 return
116117 }
117118
118- alertAcked , err := deadmansswitchCheckin (r .Context (), raw .Subject , ttl )
119+ alertAcked , err := deadmansswitchCheckin (r .Context (), raw .Subject , ttl , app )
119120 if err != nil {
120121 http .Error (w , err .Error (), http .StatusInternalServerError )
121122 return
0 commit comments