Add debug log for unexpected opsgenie responses

This commit is contained in:
Tobias Schmidt 2016-03-08 20:04:20 -05:00
parent a31e60bf12
commit bdb2cd450f

View File

@ -19,6 +19,7 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"mime"
"net"
"net/http"
@ -677,6 +678,8 @@ func (n *OpsGenie) Notify(ctx context.Context, as ...*types.Alert) error {
resp.Body.Close()
if resp.StatusCode/100 != 2 {
body, _ := ioutil.ReadAll(resp.Body)
log.With("incident", key).Debugf("unexpected OpsGenie response %s: %s", resp.Status, body)
return fmt.Errorf("unexpected status code %v", resp.StatusCode)
}
return nil