Prometheus: Do not drop errors in streaming parser (#57698) (#57835)

- Fixes #57692
- and also takes care of #42776 when using the streaming parser, not an ideal fix for #42776 but makes explore work better I think. https://github.com/grafana/grafana/issues/57365 might be a better longer term solution

(cherry picked from commit 6126f56ef0)

Co-authored-by: Kyle Brandt <kyle@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2022-10-28 10:52:36 -04:00
committed by GitHub
co-authored by Kyle Brandt
parent b1d914bceb
commit 3df51bf025
+16 -7
View File
@@ -2,6 +2,7 @@ package querydata
import (
"context"
"fmt"
"net/http"
"regexp"
"time"
@@ -110,18 +111,26 @@ func (s *QueryData) fetch(ctx context.Context, client *client.Client, q *models.
Error: nil,
}
if q.InstantQuery {
res, err := s.instantQuery(traceCtx, client, q, headers)
if err != nil {
return nil, err
}
response.Error = res.Error
response.Frames = res.Frames
}
if q.RangeQuery {
res, err := s.rangeQuery(traceCtx, client, q, headers)
if err != nil {
return nil, err
}
response.Frames = res.Frames
}
if q.InstantQuery {
res, err := s.instantQuery(traceCtx, client, q, headers)
if err != nil {
return nil, err
if res.Error != nil {
if response.Error == nil {
response.Error = res.Error
} else {
response.Error = fmt.Errorf("%v %w", response.Error, res.Error) // lovely
}
}
response.Frames = append(response.Frames, res.Frames...)
}