mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 02:10:45 -06:00
Plugins: Replace references of plugin SDK backend.Logger
with Grafana logger (#95235)
replace references
This commit is contained in:
parent
26fab52086
commit
a2868fdb14
@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/grafana/dskit/instrument"
|
||||
"github.com/grafana/dskit/middleware"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
grpcAuth "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/auth"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||
@ -118,14 +117,14 @@ func (s *gPRCServerService) Run(ctx context.Context) error {
|
||||
s.logger.Info("GRPC server: starting")
|
||||
err := s.server.Serve(listener)
|
||||
if err != nil {
|
||||
backend.Logger.Error("GRPC server: failed to serve", "err", err)
|
||||
s.logger.Error("GRPC server: failed to serve", "err", err)
|
||||
serveErr <- err
|
||||
}
|
||||
}()
|
||||
|
||||
select {
|
||||
case err := <-serveErr:
|
||||
backend.Logger.Error("GRPC server: failed to serve", "err", err)
|
||||
s.logger.Error("GRPC server: failed to serve", "err", err)
|
||||
return err
|
||||
case <-ctx.Done():
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
|
||||
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/kinds/dataquery"
|
||||
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -1150,7 +1151,7 @@ func TestBuildAppInsightsQuery(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
query, err := buildAppInsightsQuery(ctx, tt.queryModel, dsInfo, appInsightsRegExp, backend.Logger)
|
||||
query, err := buildAppInsightsQuery(ctx, tt.queryModel, dsInfo, appInsightsRegExp, log.NewNullLogger())
|
||||
tt.Err(t, err)
|
||||
if diff := cmp.Diff(&tt.azureLogAnalyticsQuery, query); diff != "" {
|
||||
t.Errorf("Result mismatch (-want +got): \n%s", diff)
|
||||
|
@ -163,7 +163,7 @@ func (e *AzureResourceGraphDatasource) executeQuery(ctx context.Context, query *
|
||||
|
||||
defer func() {
|
||||
if err := res.Body.Close(); err != nil {
|
||||
backend.Logger.Warn("Failed to close response body", "err", err)
|
||||
e.Logger.Warn("Failed to close response body", "err", err)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -90,7 +90,7 @@ func doRequestPage(_ context.Context, r *http.Request, dsInfo datasourceInfo, pa
|
||||
|
||||
defer func() {
|
||||
if err = res.Body.Close(); err != nil {
|
||||
backend.Logger.Warn("Failed to close response body", "error", err)
|
||||
logger.Warn("Failed to close response body", "error", err)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -33,7 +33,7 @@ func (l fakeLogger) With(args ...interface{}) log.Logger {
|
||||
|
||||
func TestConfigureAzureAuthentication(t *testing.T) {
|
||||
azureSettings := &azsettings.AzureSettings{}
|
||||
testLogger := backend.Logger
|
||||
testLogger := log.NewNullLogger()
|
||||
|
||||
t.Run("should set Azure middleware when JsonData contains valid credentials", func(t *testing.T) {
|
||||
settings := backend.DataSourceInstanceSettings{
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"github.com/grafana/grafana-azure-sdk-go/v2/azsettings"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
sdkhttpclient "github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@ -28,7 +29,7 @@ func TestExtendClientOpts(t *testing.T) {
|
||||
}
|
||||
ctx := backend.WithGrafanaConfig(context.Background(), cfg)
|
||||
opts := &sdkhttpclient.Options{}
|
||||
err := extendClientOpts(ctx, settings, opts, backend.Logger)
|
||||
err := extendClientOpts(ctx, settings, opts, log.NewNullLogger())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(opts.Middlewares))
|
||||
})
|
||||
@ -47,7 +48,7 @@ func TestExtendClientOpts(t *testing.T) {
|
||||
SecretKey: "secretkey",
|
||||
},
|
||||
}
|
||||
err := extendClientOpts(context.Background(), settings, opts, backend.Logger)
|
||||
err := extendClientOpts(context.Background(), settings, opts, log.NewNullLogger())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "aps", opts.SigV4.Service)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user