Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade grafana-plugin-sdk-go (deps): Bump github.com/grafana/grafana-plugin-sdk-go from 0.259.4 to 0.260.1 #1078

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.1
require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.1
github.com/grafana/grafana-aws-sdk v0.31.2
github.com/grafana/grafana-plugin-sdk-go v0.259.4
github.com/grafana/grafana-plugin-sdk-go v0.260.1
github.com/grafana/infinity-libs/lib/go/csvframer v1.0.1
github.com/grafana/infinity-libs/lib/go/framesql v1.0.2
github.com/grafana/infinity-libs/lib/go/gframer v1.0.0
Expand All @@ -14,10 +14,10 @@ require (
github.com/grafana/infinity-libs/lib/go/transformations v1.0.3
github.com/grafana/infinity-libs/lib/go/xmlframer v1.0.0
github.com/icholy/digest v0.1.22
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.10.0
go.opentelemetry.io/otel v1.32.0
go.opentelemetry.io/otel/trace v1.32.0
golang.org/x/oauth2 v0.23.0
golang.org/x/oauth2 v0.24.0
moul.io/http2curl v1.0.0
)

Expand Down Expand Up @@ -116,13 +116,13 @@ require (
go.opentelemetry.io/otel/metric v1.32.0 // indirect
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/tools v0.24.0 // indirect
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
Expand Down
23 changes: 12 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ github.com/grafana/dataplane/sdata v0.0.9 h1:AGL1LZnCUG4MnQtnWpBPbQ8ZpptaZs14w6k
github.com/grafana/dataplane/sdata v0.0.9/go.mod h1:Jvs5ddpGmn6vcxT7tCTWAZ1mgi4sbcdFt9utQx5uMAU=
github.com/grafana/grafana-aws-sdk v0.31.2 h1:Mv01GAHcIG3S2pVtRlt1cUnnWzUAr4qr74HJvYv11JQ=
github.com/grafana/grafana-aws-sdk v0.31.2/go.mod h1:5nt5Gmp6+GyM+Jr7xsXKJtbizxbYXXLmEac6kw5paQI=
github.com/grafana/grafana-plugin-sdk-go v0.259.4 h1:Qt/Ic+7K7n7z4ncZs29q2OhOOPKWjE5+ms2ckeYlTo4=
github.com/grafana/grafana-plugin-sdk-go v0.259.4/go.mod h1:BS2B+lEHC4KtOViiS4C5x9SsR1ihPHAzesGOpaPYeCs=
github.com/grafana/grafana-plugin-sdk-go v0.260.1 h1:KzbooQP9mv/9CPsn+SoUwGuomA8oUxO0iuIq6Rg/ekE=
github.com/grafana/grafana-plugin-sdk-go v0.260.1/go.mod h1:JriieK5Oc5v120QKhMs/LO55N0P3YI2ttEiVT1wfYsw=
github.com/grafana/infinity-libs/lib/go/csvframer v1.0.1 h1:SBL+Ix6E1Ec6QPdAkq/yhyqvicV5wyWlHKB0bH8jjIA=
github.com/grafana/infinity-libs/lib/go/csvframer v1.0.1/go.mod h1:gVqJA9np8h1RpZYemoVouIe/b3m2lUc5HVAbdM7K8sM=
github.com/grafana/infinity-libs/lib/go/framesql v1.0.2 h1:fWTC2tG9nKx8xp9V/IXfeEC7auMEBTE/FxysEeKC1fg=
Expand Down Expand Up @@ -260,8 +260,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U=
github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
Expand Down Expand Up @@ -322,8 +323,8 @@ go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
Expand All @@ -335,10 +336,10 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -359,8 +360,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
Expand Down
31 changes: 15 additions & 16 deletions pkg/infinity/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/backend/proxy"
"github.com/grafana/grafana-plugin-sdk-go/backend/tracing"
"github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource"
"github.com/icholy/digest"
"golang.org/x/oauth2"
)
Expand Down Expand Up @@ -198,15 +197,15 @@ func (client *Client) req(ctx context.Context, url string, body io.Reader, setti
defer span.End()
req, err := GetRequest(ctx, settings, body, query, requestHeaders, true)
if err != nil {
return nil, http.StatusInternalServerError, 0, errorsource.DownstreamError(fmt.Errorf("error preparing request. %w", err), false)
return nil, http.StatusInternalServerError, 0, backend.DownstreamError(fmt.Errorf("error preparing request. %w", err))
}
if req == nil {
return nil, http.StatusInternalServerError, 0, errorsource.DownstreamError(errors.New("error preparing request. invalid request constructed"), false)
return nil, http.StatusInternalServerError, 0, backend.DownstreamError(errors.New("error preparing request. invalid request constructed"))
}
startTime := time.Now()
if !CanAllowURL(req.URL.String(), settings.AllowedHosts) {
logger.Debug("url is not in the allowed list. make sure to match the base URL with the settings", "url", req.URL.String())
return nil, http.StatusUnauthorized, 0, errorsource.DownstreamError(errors.New("requested URL is not allowed. To allow this URL, update the datasource config Security -> Allowed Hosts section"), false)
return nil, http.StatusUnauthorized, 0, backend.DownstreamError(errors.New("requested URL is not allowed. To allow this URL, update the datasource config Security -> Allowed Hosts section"))
}
logger.Debug("requesting URL", "host", req.URL.Hostname(), "url_path", req.URL.Path, "method", req.Method, "type", query.Type)
res, err := client.HttpClient.Do(req)
Expand All @@ -220,37 +219,37 @@ func (client *Client) req(ctx context.Context, url string, body io.Reader, setti
logger.Debug("error getting response from server", "url", url, "method", req.Method, "error", err.Error(), "status code", res.StatusCode)
// Infinity can query anything and users are responsible for ensuring that endpoint/auth is correct
// therefore any incoming error is considered downstream
return nil, res.StatusCode, duration, errorsource.DownstreamError(fmt.Errorf("error getting response from %s", url), false)
return nil, res.StatusCode, duration, backend.DownstreamError(fmt.Errorf("error getting response from %s", url))
}
if errors.Is(err, context.Canceled) {
logger.Debug("request cancelled", "url", url, "method", req.Method)
return nil, http.StatusInternalServerError, duration, errorsource.DownstreamError(err, false)
return nil, http.StatusInternalServerError, duration, backend.DownstreamError(err)
}
logger.Debug("error getting response from server. no response received", "url", url, "error", err.Error())
return nil, http.StatusInternalServerError, duration, errorsource.DownstreamError(fmt.Errorf("error getting response from url %s. no response received. Error: %w", url, err), false)
return nil, http.StatusInternalServerError, duration, backend.DownstreamError(fmt.Errorf("error getting response from url %s. no response received. Error: %w", url, err))
}
if res == nil {
logger.Debug("invalid response from server and also no error", "url", url, "method", req.Method)
return nil, http.StatusInternalServerError, duration, errorsource.DownstreamError(fmt.Errorf("invalid response received for the URL %s", url), false)
return nil, http.StatusInternalServerError, duration, backend.DownstreamError(fmt.Errorf("invalid response received for the URL %s", url))
}
if res.StatusCode >= http.StatusBadRequest {
err = fmt.Errorf("%w. %s", ErrUnsuccessfulHTTPResponseStatus, res.Status)
// Infinity can query anything and users are responsible for ensuring that endpoint/auth is correct
// therefore any incoming error is considered downstream
return nil, res.StatusCode, duration, errorsource.DownstreamError(err, false)
return nil, res.StatusCode, duration, backend.DownstreamError(err)
}
bodyBytes, err := io.ReadAll(res.Body)
if err != nil {
logger.Debug("error reading response body", "url", url, "error", err.Error())
return nil, res.StatusCode, duration, errorsource.DownstreamError(err, false)
return nil, res.StatusCode, duration, backend.DownstreamError(err)
}
bodyBytes = removeBOMContent(bodyBytes)
if CanParseAsJSON(query.Type, res.Header) {
var out any
err := json.Unmarshal(bodyBytes, &out)
if err != nil {
err = fmt.Errorf("%w. %w", ErrParsingResponseBodyAsJson, err)
err = errorsource.DownstreamError(err, false)
err = backend.DownstreamError(err)
logger.Debug("error un-marshaling JSON response", "url", url, "error", err.Error())
}
return out, res.StatusCode, duration, err
Expand All @@ -267,27 +266,27 @@ func (client *Client) GetResults(ctx context.Context, query models.Query, reques
logger := backend.Logger.FromContext(ctx)
if query.Source == "azure-blob" {
if strings.TrimSpace(query.AzBlobContainerName) == "" || strings.TrimSpace(query.AzBlobName) == "" {
return nil, http.StatusBadRequest, 0, errorsource.DownstreamError(errors.New("invalid/empty container name/blob name"), false)
return nil, http.StatusBadRequest, 0, backend.DownstreamError(errors.New("invalid/empty container name/blob name"))
}
if client.AzureBlobClient == nil {
return nil, http.StatusInternalServerError, 0, errorsource.PluginError(errors.New("invalid azure blob client"), false)
return nil, http.StatusInternalServerError, 0, backend.PluginError(errors.New("invalid azure blob client"))
}
blobDownloadResponse, err := client.AzureBlobClient.DownloadStream(ctx, strings.TrimSpace(query.AzBlobContainerName), strings.TrimSpace(query.AzBlobName), nil)
if err != nil {
return nil, http.StatusInternalServerError, 0, errorsource.DownstreamError(err, false)
return nil, http.StatusInternalServerError, 0, backend.DownstreamError(err)
}
reader := blobDownloadResponse.Body
bodyBytes, err := io.ReadAll(reader)
if err != nil {
return nil, http.StatusInternalServerError, 0, errorsource.PluginError(fmt.Errorf("error reading blob content. %w", err), false)
return nil, http.StatusInternalServerError, 0, backend.PluginError(fmt.Errorf("error reading blob content. %w", err))
}
bodyBytes = removeBOMContent(bodyBytes)
if CanParseAsJSON(query.Type, http.Header{}) {
var out any
err := json.Unmarshal(bodyBytes, &out)
if err != nil {
logger.Error("error un-marshaling blob content", "error", err.Error())
err = errorsource.PluginError(err, false)
err = backend.PluginError(err)
}
return out, http.StatusOK, duration, err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/infinity/csvBackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"errors"

"github.com/grafana/grafana-infinity-datasource/pkg/models"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"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"
"github.com/grafana/infinity-libs/lib/go/csvframer"
"github.com/grafana/infinity-libs/lib/go/gframer"
)
Expand Down Expand Up @@ -48,9 +48,9 @@ func GetCSVBackendResponse(ctx context.Context, responseString string, query mod
}
if err != nil {
if errors.Is(err, csvframer.ErrEmptyCsv) || errors.Is(err, csvframer.ErrReadingCsvResponse) {
err = errorsource.DownstreamError(err, false)
err = backend.DownstreamError(err)
} else {
err = errorsource.PluginError(err , false)
err = backend.PluginError(err)
}
}
return frame, err
Expand Down
5 changes: 2 additions & 3 deletions pkg/infinity/googleSheets.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/grafana/grafana-infinity-datasource/pkg/models"
"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/infinity-libs/lib/go/gframer"
)

Expand Down Expand Up @@ -49,7 +48,7 @@ func GetGoogleSheetsResponse(ctx context.Context, urlResponseObject any, query m
Query: query,
Error: "invalid response received from google sheets",
}
return frame, errorsource.DownstreamError(errors.New("invalid response received from google sheets"), false)
return frame, backend.DownstreamError(errors.New("invalid response received from google sheets"))
}
sheet := &Spreadsheet{}
if err := json.Unmarshal([]byte(sheetsString), &sheet); err != nil {
Expand All @@ -58,7 +57,7 @@ func GetGoogleSheetsResponse(ctx context.Context, urlResponseObject any, query m
Query: query,
Error: "invalid response received from google sheets",
}
return frame, errorsource.DownstreamError(errors.New("invalid response received from google sheets"), false)
return frame, backend.DownstreamError(errors.New("invalid response received from google sheets"))
}
if sheet != nil && len(sheet.Sheets) > 0 && len(sheet.Sheets[0].Data) > 0 {
parsedCSV := [][]string{}
Expand Down
4 changes: 2 additions & 2 deletions pkg/infinity/inline.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"

"github.com/grafana/grafana-infinity-datasource/pkg/models"
"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/infinity-libs/lib/go/jsonframer"
)

Expand Down Expand Up @@ -49,7 +49,7 @@ func GetFrameForInlineSources(ctx context.Context, query models.Query) (*data.Fr
})
if err != nil {
if errors.Is(err, jsonframer.ErrInvalidRootSelector) || errors.Is(err, jsonframer.ErrInvalidJSONContent) || errors.Is(err, jsonframer.ErrEvaluatingJSONata) {
return frame, errorsource.DownstreamError(fmt.Errorf("error converting json data to frame: %w", err), false)
return frame, backend.DownstreamError(fmt.Errorf("error converting json data to frame: %w", err))
}
return frame, err
}
Expand Down
7 changes: 3 additions & 4 deletions pkg/infinity/jsonBackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/backend"
"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"
"github.com/grafana/infinity-libs/lib/go/jsonframer"
)

Expand All @@ -23,7 +22,7 @@ func GetJSONBackendResponse(ctx context.Context, urlResponseObject any, query mo
if err != nil {
logger.Error("error json parsing root data", "error", err.Error())
frame.Meta.Custom = &CustomMeta{Query: query, Error: err.Error()}
return frame, errorsource.PluginError(fmt.Errorf("error parsing json root data"), false)
return frame, backend.PluginError(fmt.Errorf("error parsing json root data"))
}
columns := []jsonframer.ColumnSelector{}
for _, c := range query.Columns {
Expand All @@ -42,9 +41,9 @@ func GetJSONBackendResponse(ctx context.Context, urlResponseObject any, query mo

if err != nil {
if errors.Is(err, jsonframer.ErrInvalidRootSelector) || errors.Is(err, jsonframer.ErrInvalidJSONContent) || errors.Is(err, jsonframer.ErrEvaluatingJSONata) {
return frame, errorsource.DownstreamError(fmt.Errorf("error converting json data to frame: %w", err), false)
return frame, backend.DownstreamError(fmt.Errorf("error converting json data to frame: %w", err))
}
return frame, errorsource.PluginError(fmt.Errorf("error converting json data to frame: %w", err), false)
return frame, backend.PluginError(fmt.Errorf("error converting json data to frame: %w", err))
}
if newFrame != nil {
frame.Fields = append(frame.Fields, newFrame.Fields...)
Expand Down
4 changes: 2 additions & 2 deletions pkg/infinity/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"time"

"github.com/grafana/grafana-infinity-datasource/pkg/models"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"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"
)

type CustomMeta struct {
Expand Down Expand Up @@ -47,7 +47,7 @@ func WrapMetaForInlineQuery(ctx context.Context, frame *data.Frame, err error, q
customMeta := &CustomMeta{Query: query, Data: query.Data, ResponseCodeFromServer: 0}
if err != nil {
customMeta.Error = err.Error()
err = errorsource.PluginError(err, false)
err = backend.PluginError(err)
}
frame.Meta = &data.FrameMeta{
ExecutedQueryString: "This feature is not available for this type of query yet",
Expand Down
Loading
Loading