From c28689e7e1395b6e5a15981ae1e1be252d5a1f41 Mon Sep 17 00:00:00 2001 From: Arkady Emelyanov Date: Thu, 23 Nov 2017 17:39:43 +0300 Subject: [PATCH] just in case, add debug output --- plugins/inputs/burrow/types.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/burrow/types.go b/plugins/inputs/burrow/types.go index 59b3d600ca2c5..ead2b047dc290 100644 --- a/plugins/inputs/burrow/types.go +++ b/plugins/inputs/burrow/types.go @@ -3,9 +3,11 @@ package burrow import ( "encoding/json" "errors" + "fmt" + "io/ioutil" + "log" "net/http" - "fmt" "github.com/influxdata/telegraf" ) @@ -115,11 +117,17 @@ func (api *apiClient) call(uri string) (apiResponse, error) { // decode response defer res.Body.Close() + body, err := ioutil.ReadAll(res.Body) + if err != nil { + return br, err + } + + log.Printf("D! call: %s, code: %d, body: %s\n", req.URL.String(), res.StatusCode, string(body)) if res.StatusCode != http.StatusOK { return br, fmt.Errorf("endpoint: '%s', invalid response code: '%d'", uri, res.StatusCode) } - if err := json.NewDecoder(res.Body).Decode(&br); err != nil { + if err := json.Unmarshal(body, &br); err != nil { return br, err }