diff --git a/src/query/api/v1/handler/prometheus/native/read.go b/src/query/api/v1/handler/prometheus/native/read.go index 202896a516..b8eac61e1d 100644 --- a/src/query/api/v1/handler/prometheus/native/read.go +++ b/src/query/api/v1/handler/prometheus/native/read.go @@ -183,7 +183,7 @@ func (h *PromReadHandler) ServeHTTPWithEngine( w http.ResponseWriter, r *http.Request, engine executor.Engine, - opts *executor.QueryOptions, + queryOpts *executor.QueryOptions, fetchOpts *storage.FetchOptions, ) ([]*ts.Series, models.RequestParams, *RespError) { ctx := context.WithValue(r.Context(), handler.HeaderKey, r.Header) @@ -197,7 +197,7 @@ func (h *PromReadHandler) ServeHTTPWithEngine( } if params.Debug { - logger.Info("Request params", zap.Any("params", params)) + logger.Info("request params", zap.Any("params", params)) } if err := h.validateRequest(¶ms); err != nil { @@ -205,13 +205,17 @@ func (h *PromReadHandler) ServeHTTPWithEngine( return nil, emptyReqParams, &RespError{Err: err, Code: http.StatusBadRequest} } - result, err := read(ctx, engine, opts, fetchOpts, h.tagOpts, + result, err := read(ctx, engine, queryOpts, fetchOpts, h.tagOpts, w, params, h.instrumentOpts) if err != nil { sp := xopentracing.SpanFromContextOrNoop(ctx) sp.LogFields(opentracinglog.Error(err)) opentracingext.Error.Set(sp, true) - logger.Error("unable to fetch data", zap.Error(err)) + logger.Error("range query error", + zap.Error(err), + zap.Any("params", params), + zap.Any("queryOpts", queryOpts), + zap.Any("fetchOpts", fetchOpts)) h.promReadMetrics.fetchErrorsServer.Inc(1) return nil, emptyReqParams, &RespError{ Err: err, diff --git a/src/query/api/v1/handler/prometheus/native/read_instantaneous.go b/src/query/api/v1/handler/prometheus/native/read_instantaneous.go index 38e746008f..a278c160b0 100644 --- a/src/query/api/v1/handler/prometheus/native/read_instantaneous.go +++ b/src/query/api/v1/handler/prometheus/native/read_instantaneous.go @@ -111,7 +111,11 @@ func (h *PromReadInstantHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques result, err := read(ctx, h.engine, queryOpts, fetchOpts, h.tagOpts, w, params, h.instrumentOpts) if err != nil { - logger.Error("unable to fetch data", zap.Error(err)) + logger.Error("instant query error", + zap.Error(err), + zap.Any("params", params), + zap.Any("queryOpts", queryOpts), + zap.Any("fetchOpts", queryOpts)) xhttp.Error(w, err, http.StatusInternalServerError) return } diff --git a/src/query/api/v1/handler/prometheus/remote/read.go b/src/query/api/v1/handler/prometheus/remote/read.go index de1cbaf7b8..06118f5cdc 100644 --- a/src/query/api/v1/handler/prometheus/remote/read.go +++ b/src/query/api/v1/handler/prometheus/remote/read.go @@ -124,7 +124,11 @@ func (h *PromReadHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { readResult, err := h.read(ctx, w, req, timeout, fetchOpts) if err != nil { h.promReadMetrics.fetchErrorsServer.Inc(1) - logger.Error("unable to fetch data", zap.Error(err)) + logger.Error("remote read query error", + zap.Error(err), + zap.Any("req", req), + zap.Duration("timeout", timeout), + zap.Any("fetchOpts", fetchOpts)) xhttp.Error(w, err, http.StatusInternalServerError) return } diff --git a/src/query/api/v1/handler/search.go b/src/query/api/v1/handler/search.go index 9eeb9fd1a1..fe6e5a5f05 100644 --- a/src/query/api/v1/handler/search.go +++ b/src/query/api/v1/handler/search.go @@ -67,16 +67,19 @@ func (h *SearchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { logger := logging.WithContext(r.Context(), h.instrumentOpts) query, parseBodyErr := h.parseBody(r) - opts, parseURLParamsErr := h.parseURLParams(r) + fetchOpts, parseURLParamsErr := h.parseURLParams(r) if err := firstParseError(parseBodyErr, parseURLParamsErr); err != nil { logger.Error("unable to parse request", zap.Error(err.Inner())) xhttp.Error(w, err.Inner(), err.Code()) return } - results, err := h.search(r.Context(), query, opts) + results, err := h.search(r.Context(), query, fetchOpts) if err != nil { - logger.Error("unable to fetch data", zap.Error(err)) + logger.Error("search query error", + zap.Error(err), + zap.Any("query", query), + zap.Any("fetchOpts", fetchOpts)) xhttp.Error(w, err, http.StatusBadRequest) return }