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

- 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
pull/57838/head
Kyle Brandt 3 years ago committed by GitHub
parent c2e9e797b3
commit 6126f56ef0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      pkg/tsdb/prometheus/querydata/request.go

@ -2,6 +2,7 @@ package querydata
import (
"context"
"fmt"
"net/http"
"regexp"
"time"
@ -112,19 +113,27 @@ func (s *QueryData) fetch(ctx context.Context, client *client.Client, q *models.
Error: nil,
}
if q.RangeQuery {
res, err := s.rangeQuery(traceCtx, client, q, headers)
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.InstantQuery {
res, err := s.instantQuery(traceCtx, client, q, headers)
if q.RangeQuery {
res, err := s.rangeQuery(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...)
}

Loading…
Cancel
Save