mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Azure Monitor Logs: Avoid warning when the response is empty (#59211)
This commit is contained in:
parent
ad96b240fc
commit
9d88e14f01
@ -315,6 +315,10 @@ type LogAnalyticsMeta struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setAdditionalFrameMeta(frame *data.Frame, query, subscriptionID, workspace string) error {
|
func setAdditionalFrameMeta(frame *data.Frame, query, subscriptionID, workspace string) error {
|
||||||
|
if frame.Meta == nil || frame.Meta.Custom == nil {
|
||||||
|
// empty response
|
||||||
|
return nil
|
||||||
|
}
|
||||||
frame.Meta.ExecutedQueryString = query
|
frame.Meta.ExecutedQueryString = query
|
||||||
la, ok := frame.Meta.Custom.(*LogAnalyticsMeta)
|
la, ok := frame.Meta.Custom.(*LogAnalyticsMeta)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||||
|
"github.com/grafana/grafana-plugin-sdk-go/data"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/infra/log"
|
"github.com/grafana/grafana/pkg/infra/log"
|
||||||
@ -242,3 +243,11 @@ func Test_executeQueryErrorWithDifferentLogAnalyticsCreds(t *testing.T) {
|
|||||||
t.Error("expecting the error to inform of bad credentials")
|
t.Error("expecting the error to inform of bad credentials")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_setAdditionalFrameMeta(t *testing.T) {
|
||||||
|
t.Run("it should not error with an empty response", func(t *testing.T) {
|
||||||
|
frame := data.NewFrame("test")
|
||||||
|
err := setAdditionalFrameMeta(frame, "", "", "")
|
||||||
|
require.NoError(t, err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user