Azure Monitor: use NewLoggerWith func instead of backend.Logger (#81124)

using NewLoggerWith
This commit is contained in:
Andrew Hackmann
2024-01-26 22:53:55 +00:00
committed by GitHub
parent 0530021396
commit b411aa7266
8 changed files with 49 additions and 28 deletions
@@ -17,6 +17,7 @@ import (
"time"
"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"
"github.com/grafana/grafana-plugin-sdk-go/data"
"go.opentelemetry.io/otel/attribute"
@@ -30,7 +31,8 @@ import (
// AzureLogAnalyticsDatasource calls the Azure Log Analytics API's
type AzureLogAnalyticsDatasource struct {
Proxy types.ServiceProxy
Proxy types.ServiceProxy
Logger log.Logger
}
// AzureLogAnalyticsQuery is the query request that is built from the saved values for
@@ -300,7 +302,7 @@ func (e *AzureLogAnalyticsDatasource) executeQuery(ctx context.Context, query *A
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)
}
}()
@@ -610,7 +612,7 @@ func getCorrelationWorkspaces(ctx context.Context, baseResource string, resource
defer func() {
if err := res.Body.Close(); err != nil {
backend.Logger.Warn("Failed to close response body", "err", err)
azMonService.Logger.Warn("Failed to close response body", "err", err)
}
}()
@@ -714,7 +716,7 @@ func (e *AzureLogAnalyticsDatasource) unmarshalResponse(res *http.Response) (Azu
}
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)
}
}()