mirror of
https://github.com/prometheus/alertmanager
synced 2025-01-19 12:40:49 +00:00
more readable HTTP response logging
This commit is contained in:
parent
48cdc777ce
commit
9632bf24f8
@ -508,13 +508,17 @@ func (n *notifier) sendPushoverNotification(token string, op notificationOp, use
|
||||
}
|
||||
|
||||
func processResponse(r *http.Response, targetName string, a *Alert) {
|
||||
defer r.Body.Close()
|
||||
|
||||
respBuf, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
glog.Errorln("Error reading HTTP response:", err)
|
||||
spec := fmt.Sprintf("%s notification for alert %v", targetName, a.Fingerprint())
|
||||
if r == nil {
|
||||
glog.Errorln("No HTTP response for", spec)
|
||||
} else {
|
||||
defer r.Body.Close()
|
||||
respBuf, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
glog.Errorln("Error reading HTTP response for", spec, err)
|
||||
}
|
||||
glog.Infof("Sent %s. Response: HTTP %d: %s", spec, r.StatusCode, respBuf)
|
||||
}
|
||||
glog.Infof("Sent %s notification for alert %v. Response: HTTP %d: %s", targetName, a.Fingerprint(), r.StatusCode, respBuf)
|
||||
}
|
||||
|
||||
func (n *notifier) handleNotification(a *Alert, op notificationOp, config *pb.NotificationConfig) {
|
||||
|
Loading…
Reference in New Issue
Block a user