Skip to content

Commit

Permalink
debug #10900
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj committed Apr 21, 2022
1 parent 6ba3b1e commit 040ea48
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 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,8 @@ func (h *InfluxDBListener) handleWriteInternalParser(res http.ResponseWriter, re
var err error
body, err = gzip.NewReader(body)
if err != nil {
h.Log.Debug("error using new 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 +331,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 +351,11 @@ func (h *InfluxDBListener) handleWriteUpstreamParser(res http.ResponseWriter, re
var err error
body, err = gzip.NewReader(body)
if err != nil {
h.Log.Debug("error using gzip reader")
h.Log.Debugf("'%s': '%s'\n", err, err.Error())
if err == influx_upstream.ErrEOF {
return
}
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 040ea48

Please sign in to comment.