Prometheus: Fix handling errors in streaming client (#61643)
* Return errors from data parsing * Better error handling * Fix the tests * When there is no frame add empty frame to get metadata attached to it * Fix tests * Update testdata
This commit is contained in:
@@ -125,23 +125,17 @@ func (s *QueryData) fetch(ctx context.Context, client *client.Client, q *models.
|
||||
|
||||
if q.InstantQuery {
|
||||
res, err := s.instantQuery(traceCtx, client, q, headers)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.Error = res.Error
|
||||
response.Error = err
|
||||
response.Frames = res.Frames
|
||||
}
|
||||
|
||||
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
|
||||
response.Error = err
|
||||
} else {
|
||||
response.Error = fmt.Errorf("%v %w", response.Error, res.Error) // lovely
|
||||
response.Error = fmt.Errorf("%v %w", response.Error, err)
|
||||
}
|
||||
}
|
||||
response.Frames = append(response.Frames, res.Frames...)
|
||||
|
||||
Reference in New Issue
Block a user