Skip to content

Commit

Permalink
Prometheus: Do not drop errors in streaming parser (grafana#57698)
Browse files Browse the repository at this point in the history
- Fixes grafana#57692
- and also takes care of grafana#42776 when using the streaming parser, not an ideal fix for grafana#42776 but makes explore work better I think. grafana#57365 might be a better longer term solution
  • Loading branch information
kylebrandt authored Oct 28, 2022
1 parent c2e9e79 commit 6126f56
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pkg/tsdb/prometheus/querydata/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package querydata

import (
"context"
"fmt"
"net/http"
"regexp"
"time"
Expand Down Expand Up @@ -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...)
}

Expand Down

0 comments on commit 6126f56

Please sign in to comment.