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 2016-12-06 15:52:50 +01:00
parent 893390e0c6
commit 9d68e81b32
1 changed files with 2 additions and 2 deletions

View File

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