datasources: querier: more robust error handling, and report no errors for single-tenant (#106288)
* datasources: querier: more robust error handling, and report no error for st * do not leak error details out * apply the change to the real file, not just to the test
This commit is contained in:
@@ -2,7 +2,6 @@ package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
data "github.com/grafana/grafana-plugin-sdk-go/experimental/apis/data/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/registry/apis/query/clientapi"
|
||||
@@ -17,5 +16,6 @@ func (s *CommonDataSourceClientSupplier) GetDataSourceClient(_ context.Context,
|
||||
}
|
||||
|
||||
func (s *CommonDataSourceClientSupplier) GetInstanceConfigurationSettings(_ context.Context) (clientapi.InstanceConfigurationSettings, error) {
|
||||
return clientapi.InstanceConfigurationSettings{}, errors.New("get instance configuration settings is not implemented")
|
||||
// FIXME: for now it's an empty structure, we'll find a way to fill it correctly.
|
||||
return clientapi.InstanceConfigurationSettings{}, nil
|
||||
}
|
||||
|
||||
@@ -186,7 +186,10 @@ func (r *queryREST) Connect(connectCtx context.Context, name string, _ runtime.O
|
||||
// Fetch information on the grafana instance (e.g. feature toggles)
|
||||
instanceConfig, err := b.clientSupplier.GetInstanceConfigurationSettings(ctx)
|
||||
if err != nil {
|
||||
b.log.Error("failed to get instance configuration settings", "err", err)
|
||||
msg := "failed to get instance configuration settings"
|
||||
b.log.Error(msg, "err", err)
|
||||
responder.Error(errors.New(msg))
|
||||
return
|
||||
}
|
||||
|
||||
// Actually run the query (includes expressions)
|
||||
|
||||
@@ -3,7 +3,6 @@ package query
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
@@ -172,5 +171,5 @@ func (m mockClient) CheckHealth(ctx context.Context, req *backend.CheckHealthReq
|
||||
}
|
||||
|
||||
func (m mockClient) GetInstanceConfigurationSettings(_ context.Context) (clientapi.InstanceConfigurationSettings, error) {
|
||||
return clientapi.InstanceConfigurationSettings{}, errors.New("get instance configuration settings is not implemented")
|
||||
return clientapi.InstanceConfigurationSettings{}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user