Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
iwysiu committed Sep 5, 2024
1 parent 1cc40d9 commit af59d41
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion pkg/opensearch/lucene_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ func (h *luceneHandler) executeQueries(ctx context.Context) (*backend.QueryDataR

res, err := h.client.ExecuteMultisearch(ctx, req)
if err != nil {
backend.Logger.Warn("executeMultisearch", "err", err)
// We are returning the error containing the source that was added through errorsource.Middleware
return errorsource.AddErrorToResponse(h.queries[0].RefID, response, err), nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/opensearch/opensearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (ds *OpenSearchDatasource) QueryData(ctx context.Context, req *backend.Quer
// handleServiceMapPrefetch inspects the given request, and, if it wants a serviceMap, creates and
// calls the Prefetch query to get the services and operations lists that are required for
// the associated Stats query. It then adds these parameters to the originating query so
// the Stats query can be created later. Returns true if the serviceMap was fetched
// the Stats query can be created later. Returns a response with an error if the request fails.
func handleServiceMapPrefetch(ctx context.Context, osClient client.Client, req *backend.QueryDataRequest) *backend.QueryDataResponse {
for i, query := range req.Queries {
model, err := simplejson.NewJson(query.JSON)
Expand Down
6 changes: 3 additions & 3 deletions pkg/opensearch/ppl_response_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (rp *pplResponseParser) parsePPLResponse(queryRes *backend.DataResponse, co
}
ts, err := rp.parseTimestamp(row[fieldIdx], timestampFormat)
if err != nil {
errResp := errorsource.Response(err)
errResp := errorsource.Response(errorsource.PluginError(err, false))
return &errResp, nil
}
value = *utils.NullFloatToNullableTime(ts)
Expand Down Expand Up @@ -139,7 +139,7 @@ func (rp *pplResponseParser) parsePPLResponse(queryRes *backend.DataResponse, co
func (rp *pplResponseParser) parseTimeSeries(queryRes *backend.DataResponse) (*backend.DataResponse, error) {
t, err := getTimeSeriesResponseMeta(rp.Response.Schema)
if err != nil {
errResp := errorsource.Response(err)
errResp := errorsource.Response(errorsource.PluginError(err, false))
return &errResp, nil
}

Expand All @@ -153,7 +153,7 @@ func (rp *pplResponseParser) parseTimeSeries(queryRes *backend.DataResponse) (*b
for i, datarow := range rp.Response.Datarows {
err := rp.addDatarow(newFrame, i, datarow, t)
if err != nil {
errResp := errorsource.Response(err)
errResp := errorsource.Response(errorsource.PluginError(err, false))
return &errResp, nil
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/opensearch/response_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func processTraceSpansResponse(res *client.SearchResponse, queryRes backend.Data
{
startTime, err := utils.TimeFieldToMilliseconds(v)
if err != nil {
return errorsource.Response(fmt.Errorf("error parsing startTime '%+v': %w", v, err))
return errorsource.Response(errorsource.PluginError(fmt.Errorf("error parsing startTime '%+v': %w", v, err), false))
}
doc[k] = startTime
continue
Expand Down Expand Up @@ -270,7 +270,7 @@ func processTraceSpansResponse(res *client.SearchResponse, queryRes backend.Data
{
spanEvents, stackTraces, err := transformTraceEventsToLogs(v.([]interface{}))
if err != nil {
return errorsource.Response(fmt.Errorf("error parsing event.time '%+v': %w", v, err))
return errorsource.Response(errorsource.PluginError(fmt.Errorf("error parsing event.time '%+v': %w", v, err), false))
}
if spanHasError && stackTraces != nil {
if spanHasError {
Expand Down

0 comments on commit af59d41

Please sign in to comment.