Prometheus: Set Status(Code) on backend response (#80806)

Sets that status code on backend data responses in prometheus to match the status code returned by prometheus. If the failure is below HTTP/Application Layer, Bad Gateway is returned (502).

---------

Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
This commit is contained in:
Kyle Brandt
2024-01-18 13:23:31 -05:00
committed by GitHub
co-authored by ismail simsek
parent fb4125dfbb
commit 02e2e1c64e
2 changed files with 9 additions and 2 deletions
@@ -32,6 +32,7 @@ func (s *QueryData) parseResponse(ctx context.Context, q *models.Query, res *htt
r := converter.ReadPrometheusStyleResult(iter, converter.Options{
Dataplane: s.enableDataplane,
})
r.Status = backend.Status(res.StatusCode)
// Add frame to attach metadata
if len(r.Frames) == 0 && !q.ExemplarQuery {