Skip to content

Commit

Permalink
Merge pull request grafana#403 from raintank/rabbitmq-400
Browse files Browse the repository at this point in the history
Rabbitmq 400
  • Loading branch information
Anthony Woods committed Aug 11, 2015
2 parents 27370ad + 5af3eee commit bff4042
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/alerting/executor.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package alerting

import (
"bytes"
"encoding/json"
"fmt"
"net/http"
Expand Down Expand Up @@ -176,7 +177,10 @@ func execute(fn GraphiteReturner, job *Job, cache *lru.Cache) error {
requests := ""
for _, trace := range gr.Traces {
r := trace.Request
requests += fmt.Sprintf("\ntargets: %s\nfrom:%s\nto:%s\nresponse:%s\n", r.Targets, r.Start, r.End, trace.Response)
// mangle trace.Response to keep the dumped out graphite
// responses from crashing logstash
resp := bytes.Replace(trace.Response, []byte("\n"), []byte("\n> "), -1)
requests += fmt.Sprintf("\ntargets: %s\nfrom:%s\nto:%s\nresponse:%s\n", r.Targets, r.Start, r.End, resp)
}
log.Debug("Job %s state_change=%t request traces: %s", job, updateMonitorStateCmd.Affected > 0, requests)
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/services/rabbitmq/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ func (c *Consumer) getChannel() error {
log.Printf("connection to rabbitmq lost. %s", er.Error())
log.Printf("attempting to create new rabbitmq channel.")
err := c.getChannel()

if err == nil {
if c.callback != nil {
c.consume()
}
break
}

Expand Down

0 comments on commit bff4042

Please sign in to comment.