diff --git a/pkg/query-service/app/clickhouseReader/reader.go b/pkg/query-service/app/clickhouseReader/reader.go index a3d2536aa8..10057e153d 100644 --- a/pkg/query-service/app/clickhouseReader/reader.go +++ b/pkg/query-service/app/clickhouseReader/reader.go @@ -4982,7 +4982,7 @@ func (r *ClickHouseReader) GetTimeSeriesResultV3(ctx context.Context, query stri if err != nil { zap.L().Error("error while reading time series result", zap.Error(err)) - return nil, err + return nil, errors.New(err.Error()) } defer rows.Close() @@ -5029,7 +5029,7 @@ func (r *ClickHouseReader) GetListResultV3(ctx context.Context, query string) ([ if err != nil { zap.L().Error("error while reading time series result", zap.Error(err)) - return nil, err + return nil, errors.New(err.Error()) } defer rows.Close() diff --git a/pkg/query-service/app/http_handler.go b/pkg/query-service/app/http_handler.go index 6f9987a518..f7e33a8579 100644 --- a/pkg/query-service/app/http_handler.go +++ b/pkg/query-service/app/http_handler.go @@ -3716,8 +3716,12 @@ func (aH *APIHandler) queryRangeV3(ctx context.Context, queryRangeParams *v3.Que result, errQuriesByName, err = aH.querier.QueryRange(ctx, queryRangeParams) if err != nil { - apiErrObj := &model.ApiError{Typ: model.ErrorBadData, Err: err} - RespondError(w, apiErrObj, errQuriesByName) + queryErrors := map[string]string{} + for name, err := range errQuriesByName { + queryErrors[fmt.Sprintf("Query-%s", name)] = err.Error() + } + apiErrObj := &model.ApiError{Typ: model.ErrorInternal, Err: err} + RespondError(w, apiErrObj, queryErrors) return } @@ -4160,8 +4164,12 @@ func (aH *APIHandler) queryRangeV4(ctx context.Context, queryRangeParams *v3.Que result, errQuriesByName, err = aH.querierV2.QueryRange(ctx, queryRangeParams) if err != nil { - apiErrObj := &model.ApiError{Typ: model.ErrorBadData, Err: err} - RespondError(w, apiErrObj, errQuriesByName) + queryErrors := map[string]string{} + for name, err := range errQuriesByName { + queryErrors[fmt.Sprintf("Query-%s", name)] = err.Error() + } + apiErrObj := &model.ApiError{Typ: model.ErrorInternal, Err: err} + RespondError(w, apiErrObj, queryErrors) return } diff --git a/pkg/query-service/app/querier/querier.go b/pkg/query-service/app/querier/querier.go index 9adea09d47..50ef63394a 100644 --- a/pkg/query-service/app/querier/querier.go +++ b/pkg/query-service/app/querier/querier.go @@ -566,7 +566,7 @@ func (q *querier) runBuilderListQueries(ctx context.Context, params *v3.QueryRan rowList, err := q.reader.GetListResultV3(ctx, query) if err != nil { - ch <- channelResult{Err: fmt.Errorf("error in query-%s: %v", name, err), Name: name, Query: query} + ch <- channelResult{Err: err, Name: name, Query: query} return } ch <- channelResult{List: rowList, Name: name, Query: query} diff --git a/pkg/query-service/app/querier/v2/querier.go b/pkg/query-service/app/querier/v2/querier.go index 19538fa9a5..b71a8cc0cc 100644 --- a/pkg/query-service/app/querier/v2/querier.go +++ b/pkg/query-service/app/querier/v2/querier.go @@ -574,7 +574,7 @@ func (q *querier) runBuilderListQueries(ctx context.Context, params *v3.QueryRan rowList, err := q.reader.GetListResultV3(ctx, query) if err != nil { - ch <- channelResult{Err: fmt.Errorf("error in query-%s: %v", name, err), Name: name, Query: query} + ch <- channelResult{Err: err, Name: name, Query: query} return } ch <- channelResult{List: rowList, Name: name, Query: query}