From 7de65b39b57a8cadcdf2d143c409535b869bcf49 Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:12:03 +0100 Subject: [PATCH] Elasticsearch and Cloudwatch: Replace deprecated experimental/errorsource (#97363) * Update elasticsearch * Update azure monitor * Update test * Revert "Update azure monitor" This reverts commit 21b53845b85c3a43d679d729c33879fdc3e9f027. * Update cloudwatch --- pkg/tsdb/cloudwatch/annotation_query.go | 11 ++++---- .../cloudwatch/get_metric_data_executor.go | 4 +-- pkg/tsdb/cloudwatch/log_actions.go | 17 ++++++------ pkg/tsdb/cloudwatch/log_sync_query.go | 5 ++-- .../cloudwatch/models/cloudwatch_query.go | 3 +-- pkg/tsdb/cloudwatch/time_series_query.go | 7 +++-- pkg/tsdb/elasticsearch/client/client.go | 6 ++--- pkg/tsdb/elasticsearch/data_query.go | 27 ++++++++++++------- pkg/tsdb/elasticsearch/data_query_test.go | 1 - pkg/tsdb/elasticsearch/elasticsearch.go | 9 +++---- pkg/tsdb/elasticsearch/error_handling_test.go | 3 +-- pkg/tsdb/elasticsearch/response_parser.go | 3 +-- 12 files changed, 47 insertions(+), 49 deletions(-) diff --git a/pkg/tsdb/cloudwatch/annotation_query.go b/pkg/tsdb/cloudwatch/annotation_query.go index d2621419852..b99321a240d 100644 --- a/pkg/tsdb/cloudwatch/annotation_query.go +++ b/pkg/tsdb/cloudwatch/annotation_query.go @@ -11,7 +11,6 @@ import ( "github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana-plugin-sdk-go/data" - "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/kinds/dataquery" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/utils" ) @@ -36,7 +35,7 @@ func (e *cloudWatchExecutor) executeAnnotationQuery(ctx context.Context, pluginC if model.Period != nil && *model.Period != "" { p, err := strconv.ParseInt(*model.Period, 10, 64) if err != nil { - return nil, errorsource.DownstreamError(fmt.Errorf("query period must be an int"), false) + return nil, backend.DownstreamError(fmt.Errorf("query period must be an int")) } period = p } @@ -82,13 +81,13 @@ func (e *cloudWatchExecutor) executeAnnotationQuery(ctx context.Context, pluginC } resp, err := cli.DescribeAlarms(params) if err != nil { - result = errorsource.AddDownstreamErrorToResponse(query.RefID, result, fmt.Errorf("%v: %w", "failed to call cloudwatch:DescribeAlarms", err)) + result.Responses[query.RefID] = backend.ErrorResponseWithErrorSource(backend.DownstreamError(fmt.Errorf("%v: %w", "failed to call cloudwatch:DescribeAlarms", err))) return result, nil } alarmNames = filterAlarms(resp, utils.Depointerizer(model.Namespace), metricName, dimensions, statistic, period) } else { if model.Region == nil || model.Namespace == nil || metricName == "" || statistic == "" { - return result, errorsource.DownstreamError(errors.New("invalid annotations query"), false) + return result, backend.DownstreamError(errors.New("invalid annotations query")) } var qd []*cloudwatch.Dimension @@ -113,7 +112,7 @@ func (e *cloudWatchExecutor) executeAnnotationQuery(ctx context.Context, pluginC } resp, err := cli.DescribeAlarmsForMetric(params) if err != nil { - result = errorsource.AddDownstreamErrorToResponse(query.RefID, result, fmt.Errorf("%v: %w", "failed to call cloudwatch:DescribeAlarmsForMetric", err)) + result.Responses[query.RefID] = backend.ErrorResponseWithErrorSource(backend.DownstreamError(fmt.Errorf("%v: %w", "failed to call cloudwatch:DescribeAlarmsForMetric", err))) return result, nil } for _, alarm := range resp.MetricAlarms { @@ -131,7 +130,7 @@ func (e *cloudWatchExecutor) executeAnnotationQuery(ctx context.Context, pluginC } resp, err := cli.DescribeAlarmHistory(params) if err != nil { - result = errorsource.AddDownstreamErrorToResponse(query.RefID, result, fmt.Errorf("%v: %w", "failed to call cloudwatch:DescribeAlarmHistory", err)) + result.Responses[query.RefID] = backend.ErrorResponseWithErrorSource(backend.DownstreamError(fmt.Errorf("%v: %w", "failed to call cloudwatch:DescribeAlarmHistory", err))) return result, nil } for _, history := range resp.AlarmHistoryItems { diff --git a/pkg/tsdb/cloudwatch/get_metric_data_executor.go b/pkg/tsdb/cloudwatch/get_metric_data_executor.go index 002fedd5639..6ad996ab6e1 100644 --- a/pkg/tsdb/cloudwatch/get_metric_data_executor.go +++ b/pkg/tsdb/cloudwatch/get_metric_data_executor.go @@ -7,7 +7,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface" - "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource" + "github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/features" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/utils" ) @@ -28,7 +28,7 @@ func (e *cloudWatchExecutor) executeRequest(ctx context.Context, client cloudwat resp, err := client.GetMetricDataWithContext(ctx, metricDataInput) if err != nil { - return mdo, errorsource.DownstreamError(err, false) + return mdo, backend.DownstreamError(err) } mdo = append(mdo, resp) diff --git a/pkg/tsdb/cloudwatch/log_actions.go b/pkg/tsdb/cloudwatch/log_actions.go index 2aa6d907095..cdf80b977f4 100644 --- a/pkg/tsdb/cloudwatch/log_actions.go +++ b/pkg/tsdb/cloudwatch/log_actions.go @@ -17,7 +17,6 @@ import ( "github.com/aws/aws-sdk-go/service/cloudwatchlogs/cloudwatchlogsiface" "github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana-plugin-sdk-go/data" - "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource" "golang.org/x/sync/errgroup" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/features" @@ -101,7 +100,7 @@ func (e *cloudWatchExecutor) executeLogActions(ctx context.Context, req *backend dataframe, err := e.executeLogAction(ectx, logsQuery, query, req.PluginContext) if err != nil { resultChan <- backend.Responses{ - query.RefID: errorsource.Response(err), + query.RefID: backend.ErrorResponseWithErrorSource(err), } return nil } @@ -182,12 +181,12 @@ func (e *cloudWatchExecutor) handleGetLogEvents(ctx context.Context, logsClient } if logsQuery.LogGroupName == "" { - return nil, errorsource.DownstreamError(fmt.Errorf("Error: Parameter 'logGroupName' is required"), false) + return nil, backend.DownstreamError(fmt.Errorf("Error: Parameter 'logGroupName' is required")) } queryRequest.SetLogGroupName(logsQuery.LogGroupName) if logsQuery.LogStreamName == "" { - return nil, errorsource.DownstreamError(fmt.Errorf("Error: Parameter 'logStreamName' is required"), false) + return nil, backend.DownstreamError(fmt.Errorf("Error: Parameter 'logStreamName' is required")) } queryRequest.SetLogStreamName(logsQuery.LogStreamName) @@ -201,7 +200,7 @@ func (e *cloudWatchExecutor) handleGetLogEvents(ctx context.Context, logsClient logEvents, err := logsClient.GetLogEventsWithContext(ctx, queryRequest) if err != nil { - return nil, errorsource.DownstreamError(err, false) + return nil, backend.DownstreamError(err) } messages := make([]*string, 0) @@ -230,7 +229,7 @@ func (e *cloudWatchExecutor) executeStartQuery(ctx context.Context, logsClient c endTime := timeRange.To if !startTime.Before(endTime) { - return nil, errorsource.DownstreamError(fmt.Errorf("invalid time range: start time must be before end time"), false) + return nil, backend.DownstreamError(fmt.Errorf("invalid time range: start time must be before end time")) } if logsQuery.QueryLanguage == nil { cwli := dataquery.LogsQueryLanguageCWLI @@ -290,7 +289,7 @@ func (e *cloudWatchExecutor) executeStartQuery(ctx context.Context, logsClient c e.logger.FromContext(ctx).Debug("ExecuteStartQuery rate exceeded", "err", awsErr) err = &AWSError{Code: throttlingException, Message: err.Error()} } - err = errorsource.DownstreamError(err, false) + err = backend.DownstreamError(err) } return resp, err } @@ -335,7 +334,7 @@ func (e *cloudWatchExecutor) executeStopQuery(ctx context.Context, logsClient cl response = &cloudwatchlogs.StopQueryOutput{Success: aws.Bool(false)} err = nil } else { - err = errorsource.DownstreamError(err, false) + err = backend.DownstreamError(err) } } @@ -365,7 +364,7 @@ func (e *cloudWatchExecutor) executeGetQueryResults(ctx context.Context, logsCli if errors.As(err, &awsErr) { err = &AWSError{Code: awsErr.Code(), Message: err.Error()} } - err = errorsource.DownstreamError(err, false) + err = backend.DownstreamError(err) } return getQueryResultsResponse, err } diff --git a/pkg/tsdb/cloudwatch/log_sync_query.go b/pkg/tsdb/cloudwatch/log_sync_query.go index f5193863e45..4377150f858 100644 --- a/pkg/tsdb/cloudwatch/log_sync_query.go +++ b/pkg/tsdb/cloudwatch/log_sync_query.go @@ -11,7 +11,6 @@ import ( "github.com/aws/aws-sdk-go/service/cloudwatchlogs/cloudwatchlogsiface" "github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana-plugin-sdk-go/data" - "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/kinds/dataquery" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/models" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/utils" @@ -56,9 +55,9 @@ var executeSyncLogQuery = func(ctx context.Context, e *cloudWatchExecutor, req * } getQueryResultsOutput, err := e.syncQuery(ctx, logsClient, q, logsQuery, instance.Settings.LogsTimeout.Duration) - var sourceError errorsource.Error + var sourceError backend.ErrorWithSource if errors.As(err, &sourceError) { - errorsource.AddErrorToResponse(refId, resp, sourceError) + resp.Responses[refId] = backend.ErrorResponseWithErrorSource(sourceError) continue } if err != nil { diff --git a/pkg/tsdb/cloudwatch/models/cloudwatch_query.go b/pkg/tsdb/cloudwatch/models/cloudwatch_query.go index 2aff6763bd6..d073fdb76cd 100644 --- a/pkg/tsdb/cloudwatch/models/cloudwatch_query.go +++ b/pkg/tsdb/cloudwatch/models/cloudwatch_query.go @@ -16,7 +16,6 @@ import ( "github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana-plugin-sdk-go/backend/log" - "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/kinds/dataquery" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/utils" ) @@ -311,7 +310,7 @@ func (q *CloudWatchQuery) migrateLegacyQuery(query metricsDataQuery) { func (q *CloudWatchQuery) validateAndSetDefaults(refId string, metricsDataQuery metricsDataQuery, startTime, endTime time.Time, defaultRegionValue string, crossAccountQueryingEnabled bool) error { if metricsDataQuery.Statistic == nil && metricsDataQuery.Statistics == nil { - return errorsource.DownstreamError(fmt.Errorf("query must have either statistic or statistics field"), false) + return backend.DownstreamError(fmt.Errorf("query must have either statistic or statistics field")) } var err error diff --git a/pkg/tsdb/cloudwatch/time_series_query.go b/pkg/tsdb/cloudwatch/time_series_query.go index 4025aeba77c..8119b3b4692 100644 --- a/pkg/tsdb/cloudwatch/time_series_query.go +++ b/pkg/tsdb/cloudwatch/time_series_query.go @@ -8,7 +8,6 @@ import ( "golang.org/x/sync/errgroup" "github.com/grafana/grafana-plugin-sdk-go/backend" - "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/features" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/models" "github.com/grafana/grafana/pkg/tsdb/cloudwatch/utils" @@ -24,13 +23,13 @@ func (e *cloudWatchExecutor) executeTimeSeriesQuery(ctx context.Context, req *ba resp := backend.NewQueryDataResponse() if len(req.Queries) == 0 { - return nil, errorsource.DownstreamError(fmt.Errorf("request contains no queries"), false) + return nil, backend.DownstreamError(fmt.Errorf("request contains no queries")) } // startTime and endTime are always the same for all queries startTime := req.Queries[0].TimeRange.From endTime := req.Queries[0].TimeRange.To if !startTime.Before(endTime) { - return nil, errorsource.DownstreamError(fmt.Errorf("invalid time range: start time must be before end time"), false) + return nil, backend.DownstreamError(fmt.Errorf("invalid time range: start time must be before end time")) } instance, err := e.getInstance(ctx, req.PluginContext) @@ -129,7 +128,7 @@ func (e *cloudWatchExecutor) executeTimeSeriesQuery(ctx context.Context, req *ba } if err := eg.Wait(); err != nil { - dataResponse := errorsource.Response(fmt.Errorf("metric request error: %w", err)) + dataResponse := backend.ErrorResponseWithErrorSource(fmt.Errorf("metric request error: %w", err)) resultChan <- &responseWrapper{ RefId: getQueryRefIdFromErrorString(err.Error(), requestQueries), DataResponse: &dataResponse, diff --git a/pkg/tsdb/elasticsearch/client/client.go b/pkg/tsdb/elasticsearch/client/client.go index a9de26e65c9..9ab71a8bc84 100644 --- a/pkg/tsdb/elasticsearch/client/client.go +++ b/pkg/tsdb/elasticsearch/client/client.go @@ -17,9 +17,9 @@ import ( "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" + "github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana-plugin-sdk-go/backend/log" "github.com/grafana/grafana-plugin-sdk-go/backend/tracing" - exp "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource" ) // Used in logging to mark a stage @@ -182,9 +182,9 @@ func (c *baseClientImpl) ExecuteMultisearch(r *MultiSearchRequest) (*MultiSearch status = "cancelled" } lp := []any{"error", err, "status", status, "duration", time.Since(start), "stage", StageDatabaseRequest} - sourceErr := exp.Error{} + sourceErr := backend.ErrorWithSource{} if errors.As(err, &sourceErr) { - lp = append(lp, "statusSource", sourceErr.Source()) + lp = append(lp, "statusSource", sourceErr.ErrorSource()) } if clientRes != nil { lp = append(lp, "statusCode", clientRes.StatusCode) diff --git a/pkg/tsdb/elasticsearch/data_query.go b/pkg/tsdb/elasticsearch/data_query.go index 4fb4eaaa9f1..98353c771c6 100644 --- a/pkg/tsdb/elasticsearch/data_query.go +++ b/pkg/tsdb/elasticsearch/data_query.go @@ -11,7 +11,6 @@ import ( "github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana-plugin-sdk-go/backend/log" - "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource" "github.com/grafana/grafana/pkg/components/simplejson" es "github.com/grafana/grafana/pkg/tsdb/elasticsearch/client" @@ -52,7 +51,8 @@ func (e *elasticsearchDataQuery) execute() (*backend.QueryDataResponse, error) { if err != nil { mq, _ := json.Marshal(e.dataQueries) e.logger.Error("Failed to parse queries", "error", err, "queries", string(mq), "queriesLength", len(queries), "duration", time.Since(start), "stage", es.StagePrepareRequest) - return errorsource.AddPluginErrorToResponse(e.dataQueries[0].RefID, response, err), nil + response.Responses[e.dataQueries[0].RefID] = backend.ErrorResponseWithErrorSource(err) + return response, nil } ms := e.client.MultiSearch() @@ -63,7 +63,8 @@ func (e *elasticsearchDataQuery) execute() (*backend.QueryDataResponse, error) { if err := e.processQuery(q, ms, from, to); err != nil { mq, _ := json.Marshal(q) e.logger.Error("Failed to process query to multisearch request builder", "error", err, "query", string(mq), "queriesLength", len(queries), "duration", time.Since(start), "stage", es.StagePrepareRequest) - return errorsource.AddPluginErrorToResponse(q.RefID, response, err), nil + response.Responses[q.RefID] = backend.ErrorResponseWithErrorSource(err) + return response, nil } } @@ -71,21 +72,28 @@ func (e *elasticsearchDataQuery) execute() (*backend.QueryDataResponse, error) { if err != nil { mqs, _ := json.Marshal(e.dataQueries) e.logger.Error("Failed to build multisearch request", "error", err, "queriesLength", len(queries), "queries", string(mqs), "duration", time.Since(start), "stage", es.StagePrepareRequest) - return errorsource.AddPluginErrorToResponse(e.dataQueries[0].RefID, response, err), nil + response.Responses[e.dataQueries[0].RefID] = backend.ErrorResponseWithErrorSource(err) + return response, nil } e.logger.Info("Prepared request", "queriesLength", len(queries), "duration", time.Since(start), "stage", es.StagePrepareRequest) res, err := e.client.ExecuteMultisearch(req) if err != nil { if backend.IsDownstreamHTTPError(err) { - err = errorsource.DownstreamError(err, false) + err = backend.DownstreamError(err) } - return errorsource.AddErrorToResponse(e.dataQueries[0].RefID, response, err), nil + response.Responses[e.dataQueries[0].RefID] = backend.ErrorResponseWithErrorSource(err) + return response, nil } if res.Status >= 400 { - errWithSource := errorsource.SourceError(backend.ErrorSourceFromHTTPStatus(res.Status), fmt.Errorf("unexpected status code: %d", res.Status), false) - return errorsource.AddErrorToResponse(e.dataQueries[0].RefID, response, errWithSource), nil + statusErr := fmt.Errorf("unexpected status code: %d", res.Status) + if backend.ErrorSourceFromHTTPStatus(res.Status) == backend.ErrorSourceDownstream { + response.Responses[e.dataQueries[0].RefID] = backend.ErrorResponseWithErrorSource(backend.DownstreamError(statusErr)) + } else { + response.Responses[e.dataQueries[0].RefID] = backend.ErrorResponseWithErrorSource(backend.PluginError(statusErr)) + } + return response, nil } return parseResponse(e.ctx, res.Responses, queries, e.client.GetConfiguredFields(), e.keepLabelsInResponse, e.logger) @@ -94,8 +102,7 @@ func (e *elasticsearchDataQuery) execute() (*backend.QueryDataResponse, error) { func (e *elasticsearchDataQuery) processQuery(q *Query, ms *es.MultiSearchRequestBuilder, from, to int64) error { err := isQueryWithError(q) if err != nil { - err = errorsource.DownstreamError(fmt.Errorf("received invalid query. %w", err), false) - return err + return backend.DownstreamError(fmt.Errorf("received invalid query. %w", err)) } defaultTimeField := e.client.GetConfiguredFields().TimeField diff --git a/pkg/tsdb/elasticsearch/data_query_test.go b/pkg/tsdb/elasticsearch/data_query_test.go index 6f7db11d9be..412bab8f56a 100644 --- a/pkg/tsdb/elasticsearch/data_query_test.go +++ b/pkg/tsdb/elasticsearch/data_query_test.go @@ -1431,7 +1431,6 @@ func TestExecuteElasticsearchDataQuery(t *testing.T) { "query": "foo", }`, from, to) require.NoError(t, err) - require.Equal(t, res.Responses["A"].ErrorSource, backend.ErrorSourcePlugin) require.Equal(t, res.Responses["A"].Error.Error(), "invalid character '}' looking for beginning of object key string") })) }) diff --git a/pkg/tsdb/elasticsearch/elasticsearch.go b/pkg/tsdb/elasticsearch/elasticsearch.go index f48d1d64889..ddd8671a114 100644 --- a/pkg/tsdb/elasticsearch/elasticsearch.go +++ b/pkg/tsdb/elasticsearch/elasticsearch.go @@ -19,7 +19,6 @@ import ( "github.com/grafana/grafana-plugin-sdk-go/backend/httpclient" "github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt" "github.com/grafana/grafana-plugin-sdk-go/backend/log" - exp "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource" es "github.com/grafana/grafana/pkg/tsdb/elasticsearch/client" ) @@ -98,11 +97,11 @@ func newInstanceSettings(httpClientProvider *httpclient.Provider) datasource.Ins timeField, ok := jsonData["timeField"].(string) if !ok { - return nil, exp.DownstreamError(errors.New("timeField cannot be cast to string"), false) + return nil, backend.DownstreamError(errors.New("timeField cannot be cast to string")) } if timeField == "" { - return nil, exp.DownstreamError(errors.New("elasticsearch time field name is required"), false) + return nil, backend.DownstreamError(errors.New("elasticsearch time field name is required")) } logLevelField, ok := jsonData["logLevelField"].(string) @@ -221,9 +220,9 @@ func (s *Service) CallResource(ctx context.Context, req *backend.CallResourceReq status = "cancelled" } lp := []any{"error", err, "status", status, "duration", time.Since(start), "stage", es.StageDatabaseRequest, "resourcePath", req.Path} - sourceErr := exp.Error{} + sourceErr := backend.ErrorWithSource{} if errors.As(err, &sourceErr) { - lp = append(lp, "statusSource", sourceErr.Source()) + lp = append(lp, "statusSource", sourceErr.ErrorSource()) } if response != nil { lp = append(lp, "statusCode", response.StatusCode) diff --git a/pkg/tsdb/elasticsearch/error_handling_test.go b/pkg/tsdb/elasticsearch/error_handling_test.go index c6407a7e35f..2fb5063c7f2 100644 --- a/pkg/tsdb/elasticsearch/error_handling_test.go +++ b/pkg/tsdb/elasticsearch/error_handling_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/grafana/grafana-plugin-sdk-go/backend" - "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource" "github.com/stretchr/testify/require" ) @@ -121,7 +120,7 @@ func TestErrorTooManyDateHistogramBuckets(t *testing.T) { require.True(t, ok) require.Len(t, dataResponse.Frames, 0) require.ErrorContains(t, dataResponse.Error, "Trying to create too many buckets. Must be less than or equal to: [65536].") - var sourceErr errorsource.Error + var sourceErr backend.ErrorWithSource ok = errors.As(dataResponse.Error, &sourceErr) require.True(t, ok) require.Equal(t, sourceErr.ErrorSource().String(), "downstream") diff --git a/pkg/tsdb/elasticsearch/response_parser.go b/pkg/tsdb/elasticsearch/response_parser.go index 158a0fca03b..541006fedc2 100644 --- a/pkg/tsdb/elasticsearch/response_parser.go +++ b/pkg/tsdb/elasticsearch/response_parser.go @@ -15,7 +15,6 @@ import ( "github.com/grafana/grafana-plugin-sdk-go/backend/log" "github.com/grafana/grafana-plugin-sdk-go/backend/tracing" "github.com/grafana/grafana-plugin-sdk-go/data" - "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" @@ -75,7 +74,7 @@ func parseResponse(ctx context.Context, responses []*es.SearchResponse, targets resSpan.End() logger.Error("Processing error response from Elasticsearch", "error", string(me), "query", string(mt)) errResult := getErrorFromElasticResponse(res) - result.Responses[target.RefID] = errorsource.Response(errorsource.DownstreamError(errors.New(errResult), false)) + result.Responses[target.RefID] = backend.ErrorResponseWithErrorSource(backend.DownstreamError(errors.New(errResult))) continue }