diff --git a/pkg/plugins/datasource/wrapper/datasource_plugin_wrapper.go b/pkg/plugins/datasource/wrapper/datasource_plugin_wrapper.go index 0afa2a400e4..91511f96685 100644 --- a/pkg/plugins/datasource/wrapper/datasource_plugin_wrapper.go +++ b/pkg/plugins/datasource/wrapper/datasource_plugin_wrapper.go @@ -2,6 +2,7 @@ package wrapper import ( "context" + "errors" "fmt" "github.com/grafana/grafana/pkg/components/null" @@ -67,9 +68,11 @@ func (tw *DatasourcePluginWrapper) Query(ctx context.Context, ds *models.DataSou } for _, r := range pbres.Results { - res.Results[r.RefId] = &tsdb.QueryResult{ - RefId: r.RefId, - Series: []*tsdb.TimeSeries{}, + qr := &tsdb.QueryResult{ + RefId: r.RefId, + Series: []*tsdb.TimeSeries{}, + Error: errors.New(r.Error), + ErrorString: r.Error, } for _, s := range r.GetSeries() { @@ -80,7 +83,7 @@ func (tw *DatasourcePluginWrapper) Query(ctx context.Context, ds *models.DataSou points = append(points, po) } - res.Results[r.RefId].Series = append(res.Results[r.RefId].Series, &tsdb.TimeSeries{ + qr.Series = append(qr.Series, &tsdb.TimeSeries{ Name: s.Name, Tags: s.Tags, Points: points, @@ -91,7 +94,9 @@ func (tw *DatasourcePluginWrapper) Query(ctx context.Context, ds *models.DataSou if err != nil { return nil, err } - res.Results[r.RefId].Tables = mappedTables + qr.Tables = mappedTables + + res.Results[r.RefId] = qr } return res, nil