Browse Source

web: don't return federation errors over HTTP

We are writing federation responses streaming. So after
the first byte we wrote, the status header is fixed. We cannot
return an HTTP error for intermediate error but should just abort
and log instead.
pull/2259/head
Fabian Reinartz 8 years ago
parent
commit
9d68e81b32
  1. 4
      web/federate.go

4
web/federate.go

@ -92,7 +92,7 @@ func (h *Handler) federation(w http.ResponseWriter, req *http.Request) {
// creating the new one.
if protMetricFam != nil {
if err := enc.Encode(protMetricFam); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
log.With("err", err).Error("federation failed")
return
}
}
@ -133,7 +133,7 @@ func (h *Handler) federation(w http.ResponseWriter, req *http.Request) {
// Still have to ship off the last MetricFamily, if any.
if protMetricFam != nil {
if err := enc.Encode(protMetricFam); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
log.With("err", err).Error("federation failed")
}
}
}

Loading…
Cancel
Save