From e0cc74f4f497b06991fe91928c1f99834352f3bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Sep 2023 07:12:47 +0000 Subject: [PATCH 1/2] Bump github.com/grafana/grafana-plugin-sdk-go from 0.176.0 to 0.178.0 Bumps [github.com/grafana/grafana-plugin-sdk-go](https://github.com/grafana/grafana-plugin-sdk-go) from 0.176.0 to 0.178.0. - [Release notes](https://github.com/grafana/grafana-plugin-sdk-go/releases) - [Commits](https://github.com/grafana/grafana-plugin-sdk-go/compare/v0.176.0...v0.178.0) --- updated-dependencies: - dependency-name: github.com/grafana/grafana-plugin-sdk-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2573330a..35cc60a7 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/grafana/grafana-llm-app go 1.19 require ( - github.com/grafana/grafana-plugin-sdk-go v0.176.0 + github.com/grafana/grafana-plugin-sdk-go v0.178.0 github.com/launchdarkly/eventsource v1.7.1 github.com/qdrant/go-client v1.5.0 google.golang.org/grpc v1.58.2 diff --git a/go.sum b/go.sum index 2f9b6f70..e78b0434 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1 github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/grafana/grafana-plugin-sdk-go v0.176.0 h1:dayiqGR6uJyJBO8rRTp/E7oKsnEjNSS0p7vVkXy/Brw= -github.com/grafana/grafana-plugin-sdk-go v0.176.0/go.mod h1:9crAQqSzxvPe0VKC/T23cd+2I9TZb43yoOcUL/qZ5FU= +github.com/grafana/grafana-plugin-sdk-go v0.178.0 h1:/05wMOSutuMZ/PaRnYHaImPasgblr4x+DMMT4d5Yqmk= +github.com/grafana/grafana-plugin-sdk-go v0.178.0/go.mod h1:9crAQqSzxvPe0VKC/T23cd+2I9TZb43yoOcUL/qZ5FU= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= From ee8f1ae095f963f15a94b091421f9f10957f59a4 Mon Sep 17 00:00:00 2001 From: Ben Sully Date: Mon, 25 Sep 2023 08:25:52 +0100 Subject: [PATCH 2/2] Add context argument to NewApp for compatibility with new plugin SDK --- pkg/plugin/app.go | 3 ++- pkg/plugin/health_test.go | 5 +++-- pkg/plugin/resources_test.go | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/plugin/app.go b/pkg/plugin/app.go index 71e151ff..1677adf7 100644 --- a/pkg/plugin/app.go +++ b/pkg/plugin/app.go @@ -1,6 +1,7 @@ package plugin import ( + "context" "net/http" "github.com/grafana/grafana-llm-app/pkg/plugin/vector" @@ -29,7 +30,7 @@ type App struct { } // NewApp creates a new example *App instance. -func NewApp(appSettings backend.AppInstanceSettings) (instancemgmt.Instance, error) { +func NewApp(ctx context.Context, appSettings backend.AppInstanceSettings) (instancemgmt.Instance, error) { log.DefaultLogger.Debug("Creating new app instance") var app App diff --git a/pkg/plugin/health_test.go b/pkg/plugin/health_test.go index ef7044be..69dbad4d 100644 --- a/pkg/plugin/health_test.go +++ b/pkg/plugin/health_test.go @@ -95,8 +95,9 @@ func TestCheckHealth(t *testing.T) { }, } { t.Run(tc.name, func(t *testing.T) { + ctx := context.Background() // Initialize app - inst, err := NewApp(tc.settings) + inst, err := NewApp(ctx, tc.settings) if err != nil { t.Fatalf("new app: %s", err) } @@ -108,7 +109,7 @@ func TestCheckHealth(t *testing.T) { t.Fatal("inst must be of type *App") } // Request by calling CheckHealth. - resp, err := app.CheckHealth(context.Background(), &backend.CheckHealthRequest{ + resp, err := app.CheckHealth(ctx, &backend.CheckHealthRequest{ PluginContext: backend.PluginContext{ AppInstanceSettings: &tc.settings, }, diff --git a/pkg/plugin/resources_test.go b/pkg/plugin/resources_test.go index 75ab2ab2..bbeedbf9 100644 --- a/pkg/plugin/resources_test.go +++ b/pkg/plugin/resources_test.go @@ -24,8 +24,9 @@ func (s *mockCallResourceResponseSender) Send(response *backend.CallResourceResp // TestCallResource tests CallResource calls, using backend.CallResourceRequest and backend.CallResourceResponse. // This ensures the httpadapter for CallResource works correctly. func TestCallResource(t *testing.T) { + ctx := context.Background() // Initialize app - inst, err := NewApp(backend.AppInstanceSettings{}) + inst, err := NewApp(ctx, backend.AppInstanceSettings{}) if err != nil { t.Fatalf("new app: %s", err) } @@ -58,7 +59,7 @@ func TestCallResource(t *testing.T) { t.Run(tc.name, func(t *testing.T) { // Request by calling CallResource. This tests the httpadapter. var r mockCallResourceResponseSender - err = app.CallResource(context.Background(), &backend.CallResourceRequest{ + err = app.CallResource(ctx, &backend.CallResourceRequest{ Method: tc.method, Path: tc.path, Body: tc.body,