mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Prometheus: Fix showing of errors (#41356)
* Prometheus: Fix showing of errors * Refactor and add comment
This commit is contained in:
parent
998aa42e5c
commit
2daae9eba8
@ -71,9 +71,9 @@ func (s *Service) executeTimeSeriesQuery(ctx context.Context, req *backend.Query
|
||||
if err != nil {
|
||||
plog.Error("Range query failed", "query", query.Expr, "err", err)
|
||||
result.Responses[query.RefId] = backend.DataResponse{Error: err}
|
||||
} else {
|
||||
response[RangeQueryType] = rangeResponse
|
||||
continue
|
||||
}
|
||||
response[RangeQueryType] = rangeResponse
|
||||
}
|
||||
|
||||
if query.InstantQuery {
|
||||
@ -81,16 +81,17 @@ func (s *Service) executeTimeSeriesQuery(ctx context.Context, req *backend.Query
|
||||
if err != nil {
|
||||
plog.Error("Instant query failed", "query", query.Expr, "err", err)
|
||||
result.Responses[query.RefId] = backend.DataResponse{Error: err}
|
||||
} else {
|
||||
response[InstantQueryType] = instantResponse
|
||||
continue
|
||||
}
|
||||
response[InstantQueryType] = instantResponse
|
||||
}
|
||||
|
||||
// This is a special case
|
||||
// If exemplar query returns error, we want to only log it and continue with other results processing
|
||||
if query.ExemplarQuery {
|
||||
exemplarResponse, err := client.QueryExemplars(ctx, query.Expr, timeRange.Start, timeRange.End)
|
||||
if err != nil {
|
||||
plog.Error("Exemplar query failed", "query", query.Expr, "err", err)
|
||||
result.Responses[query.RefId] = backend.DataResponse{Error: err}
|
||||
} else {
|
||||
response[ExemplarQueryType] = exemplarResponse
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user