Skip to content

Commit

Permalink
debug #10900
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj committed Apr 25, 2022
1 parent 6ba3b1e commit 9f76eb3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions plugins/inputs/influxdb_listener/influxdb_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func (h *InfluxDBListener) handleWrite() http.HandlerFunc {
}

func (h *InfluxDBListener) handleWriteInternalParser(res http.ResponseWriter, req *http.Request) {
h.Log.Debugf("using internal parser")
defer h.writesServed.Incr(1)
// Check that the content length is not too large for us to handle.
if req.ContentLength > int64(h.MaxBodySize) {
Expand All @@ -239,6 +240,13 @@ func (h *InfluxDBListener) handleWriteInternalParser(res http.ResponseWriter, re
var err error
body, err = gzip.NewReader(body)
if err != nil {
if err == influx_upstream.ErrEOF {
return
}

h.Log.Debug("error using new internal gzip reader")
h.Log.Debugf("'%s': '%s'\n", err, err.Error())

h.Log.Debugf("Error decompressing request body: %v", err.Error())
if err := badRequest(res, err.Error()); err != nil {
h.Log.Debugf("error in bad-request: %v", err)
Expand Down Expand Up @@ -328,6 +336,7 @@ func (h *InfluxDBListener) handleWriteInternalParser(res http.ResponseWriter, re
}

func (h *InfluxDBListener) handleWriteUpstreamParser(res http.ResponseWriter, req *http.Request) {
h.Log.Debugf("using upstream parser")
defer h.writesServed.Incr(1)
// Check that the content length is not too large for us to handle.
if req.ContentLength > int64(h.MaxBodySize) {
Expand All @@ -347,6 +356,13 @@ func (h *InfluxDBListener) handleWriteUpstreamParser(res http.ResponseWriter, re
var err error
body, err = gzip.NewReader(body)
if err != nil {
if err == influx_upstream.ErrEOF {
return
}

h.Log.Debug("error using upstream gzip reader")
h.Log.Debugf("'%s': '%s'\n", err, err.Error())

h.Log.Debugf("Error decompressing request body: %v", err.Error())
if err := badRequest(res, err.Error()); err != nil {
h.Log.Debugf("error in bad-request: %v", err)
Expand Down

0 comments on commit 9f76eb3

Please sign in to comment.