@@ -73,6 +73,7 @@ func getLokiError(resp []byte, code int) string {
7373 }
7474 err := json .Unmarshal (resp , & f )
7575 if err != nil {
76+ hlog .WithError (err ).Errorf ("cannot unmarshal, response was: %v" , string (resp ))
7677 return fmt .Sprintf ("Unknown error from Loki\n cannot unmarshal\n %s" , resp )
7778 }
7879 message , ok := f ["message" ]
@@ -115,6 +116,7 @@ func fetchSingle(lokiClient httpclient.Caller, flowsURL string, merger loki.Merg
115116 }
116117 var qr model.QueryResponse
117118 if err := json .Unmarshal (resp , & qr ); err != nil {
119+ hlog .WithError (err ).Errorf ("cannot unmarshal, response was: %v" , string (resp ))
118120 return http .StatusInternalServerError , err
119121 }
120122 if _ , err := merger .Add (qr .Data ); err != nil {
@@ -146,6 +148,7 @@ func fetchParallel(lokiClient httpclient.Caller, queries []string, merger loki.M
146148 var qr model.QueryResponse
147149 err := json .Unmarshal (resp , & qr )
148150 if err != nil {
151+ hlog .WithError (err ).Errorf ("cannot unmarshal, response was: %v" , string (resp ))
149152 errChan <- errorWithCode {err : err , code : http .StatusInternalServerError }
150153 } else {
151154 resChan <- qr
@@ -240,6 +243,7 @@ func LokiConfig(cfg *loki.Config, param string) func(w http.ResponseWriter, r *h
240243 cfg := make (map [string ]interface {})
241244 err = yaml .Unmarshal (resp , & cfg )
242245 if err != nil {
246+ hlog .WithError (err ).Errorf ("cannot unmarshal, response was: %v" , string (resp ))
243247 writeError (w , code , err .Error ())
244248 return
245249 }
0 commit comments