Loki: fix status in body not matching http status code (#114201)
* fix: status in body not matching http status code
This commit is contained in:
@@ -199,6 +199,7 @@ func (api *LokiAPI) DataQuery(ctx context.Context, query lokiQuery, responseOpts
|
||||
res := backend.DataResponse{
|
||||
Error: err,
|
||||
ErrorSource: backend.ErrorSourceFromHTTPStatus(resp.StatusCode),
|
||||
Status: backend.Status(resp.StatusCode),
|
||||
}
|
||||
lp = append(lp, "status", "error", "error", err, "statusSource", res.ErrorSource)
|
||||
api.log.Debug("Error received from Loki", lp...)
|
||||
@@ -214,6 +215,7 @@ func (api *LokiAPI) DataQuery(ctx context.Context, query lokiQuery, responseOpts
|
||||
|
||||
iter := jsoniter.Parse(jsoniter.ConfigDefault, resp.Body, 1024)
|
||||
res := converter.ReadPrometheusStyleResult(iter, converter.Options{})
|
||||
res.Status = backend.Status(resp.StatusCode)
|
||||
|
||||
if res.Error != nil {
|
||||
span.RecordError(res.Error)
|
||||
@@ -305,7 +307,9 @@ func (api *LokiAPI) RawQuery(ctx context.Context, resourcePath string) (RawLokiR
|
||||
}
|
||||
body, err = json.Marshal(lokiResponseErr)
|
||||
if err != nil {
|
||||
return RawLokiResponse{}, err
|
||||
return RawLokiResponse{
|
||||
Status: resp.StatusCode,
|
||||
}, err
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user