From c74d86ca279ee3184113daa31aaa822380186320 Mon Sep 17 00:00:00 2001 From: Jo Date: Wed, 4 Jan 2023 16:33:18 +0000 Subject: [PATCH] SupportBundles: Move support bundles to services (#60986) * move support bundles to services * update CODEOWNERS --- .github/CODEOWNERS | 2 +- pkg/server/backgroundsvcs/background_services.go | 2 +- pkg/server/wire.go | 4 ++-- pkg/{infra => services}/supportbundles/interface.go | 0 .../supportbundles/supportbundlesimpl/api.go | 2 +- .../supportbundles/supportbundlesimpl/collectors.go | 2 +- .../supportbundles/supportbundlesimpl/db_collector.go | 2 +- .../supportbundles/supportbundlesimpl/models.go | 0 .../supportbundles/supportbundlesimpl/service.go | 2 +- .../supportbundles/supportbundlesimpl/service_bundle.go | 2 +- .../supportbundles/supportbundlesimpl/service_test.go | 2 +- .../supportbundles/supportbundlesimpl/store.go | 2 +- .../supportbundles/supportbundlesimpl/user_collector.go | 2 +- 13 files changed, 12 insertions(+), 12 deletions(-) rename pkg/{infra => services}/supportbundles/interface.go (100%) rename pkg/{infra => services}/supportbundles/supportbundlesimpl/api.go (98%) rename pkg/{infra => services}/supportbundles/supportbundlesimpl/collectors.go (99%) rename pkg/{infra => services}/supportbundles/supportbundlesimpl/db_collector.go (97%) rename pkg/{infra => services}/supportbundles/supportbundlesimpl/models.go (100%) rename pkg/{infra => services}/supportbundles/supportbundlesimpl/service.go (98%) rename pkg/{infra => services}/supportbundles/supportbundlesimpl/service_bundle.go (98%) rename pkg/{infra => services}/supportbundles/supportbundlesimpl/service_test.go (94%) rename pkg/{infra => services}/supportbundles/supportbundlesimpl/store.go (97%) rename pkg/{infra => services}/supportbundles/supportbundlesimpl/user_collector.go (94%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b2dc0797b67..ca5de8c6ff7 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -316,7 +316,7 @@ lerna.json @grafana/frontend-ops # Support bundles /public/app/features/support-bundles/ @grafana/grafana-authnz-team -/pkg/infra/supportbundles/ @grafana/grafana-authnz-team +/pkg/services/supportbundles/ @grafana/grafana-authnz-team # Grafana Partnerships Team /pkg/infra/httpclient/httpclientprovider/sigv4_middleware.go @grafana/grafana-partnerships-team diff --git a/pkg/server/backgroundsvcs/background_services.go b/pkg/server/backgroundsvcs/background_services.go index 3d9f260d870..68ed1e3f41f 100644 --- a/pkg/server/backgroundsvcs/background_services.go +++ b/pkg/server/backgroundsvcs/background_services.go @@ -4,7 +4,6 @@ import ( "github.com/grafana/grafana/pkg/api" "github.com/grafana/grafana/pkg/infra/metrics" "github.com/grafana/grafana/pkg/infra/remotecache" - "github.com/grafana/grafana/pkg/infra/supportbundles/supportbundlesimpl" "github.com/grafana/grafana/pkg/infra/tracing" uss "github.com/grafana/grafana/pkg/infra/usagestats/service" "github.com/grafana/grafana/pkg/infra/usagestats/statscollector" @@ -33,6 +32,7 @@ import ( "github.com/grafana/grafana/pkg/services/store" "github.com/grafana/grafana/pkg/services/store/entity" "github.com/grafana/grafana/pkg/services/store/sanitizer" + "github.com/grafana/grafana/pkg/services/supportbundles/supportbundlesimpl" "github.com/grafana/grafana/pkg/services/thumbs" "github.com/grafana/grafana/pkg/services/updatechecker" ) diff --git a/pkg/server/wire.go b/pkg/server/wire.go index 7283b60b453..7944477350d 100644 --- a/pkg/server/wire.go +++ b/pkg/server/wire.go @@ -20,8 +20,6 @@ import ( "github.com/grafana/grafana/pkg/infra/metrics" "github.com/grafana/grafana/pkg/infra/remotecache" "github.com/grafana/grafana/pkg/infra/serverlock" - "github.com/grafana/grafana/pkg/infra/supportbundles" - "github.com/grafana/grafana/pkg/infra/supportbundles/supportbundlesimpl" "github.com/grafana/grafana/pkg/infra/tracing" "github.com/grafana/grafana/pkg/infra/usagestats" uss "github.com/grafana/grafana/pkg/infra/usagestats/service" @@ -127,6 +125,8 @@ import ( "github.com/grafana/grafana/pkg/services/store/kind" "github.com/grafana/grafana/pkg/services/store/resolver" "github.com/grafana/grafana/pkg/services/store/sanitizer" + "github.com/grafana/grafana/pkg/services/supportbundles" + "github.com/grafana/grafana/pkg/services/supportbundles/supportbundlesimpl" "github.com/grafana/grafana/pkg/services/tag" "github.com/grafana/grafana/pkg/services/tag/tagimpl" "github.com/grafana/grafana/pkg/services/team/teamimpl" diff --git a/pkg/infra/supportbundles/interface.go b/pkg/services/supportbundles/interface.go similarity index 100% rename from pkg/infra/supportbundles/interface.go rename to pkg/services/supportbundles/interface.go diff --git a/pkg/infra/supportbundles/supportbundlesimpl/api.go b/pkg/services/supportbundles/supportbundlesimpl/api.go similarity index 98% rename from pkg/infra/supportbundles/supportbundlesimpl/api.go rename to pkg/services/supportbundles/supportbundlesimpl/api.go index 3dbbbc8b11e..9c48dde29d0 100644 --- a/pkg/infra/supportbundles/supportbundlesimpl/api.go +++ b/pkg/services/supportbundles/supportbundlesimpl/api.go @@ -9,10 +9,10 @@ import ( "github.com/grafana/grafana/pkg/api/response" "github.com/grafana/grafana/pkg/api/routing" - "github.com/grafana/grafana/pkg/infra/supportbundles" "github.com/grafana/grafana/pkg/middleware" "github.com/grafana/grafana/pkg/models" ac "github.com/grafana/grafana/pkg/services/accesscontrol" + "github.com/grafana/grafana/pkg/services/supportbundles" "github.com/grafana/grafana/pkg/web" ) diff --git a/pkg/infra/supportbundles/supportbundlesimpl/collectors.go b/pkg/services/supportbundles/supportbundlesimpl/collectors.go similarity index 99% rename from pkg/infra/supportbundles/supportbundlesimpl/collectors.go rename to pkg/services/supportbundles/supportbundlesimpl/collectors.go index eee4a047df6..ce384e73154 100644 --- a/pkg/infra/supportbundles/supportbundlesimpl/collectors.go +++ b/pkg/services/supportbundles/supportbundlesimpl/collectors.go @@ -7,10 +7,10 @@ import ( "runtime" "time" - "github.com/grafana/grafana/pkg/infra/supportbundles" "github.com/grafana/grafana/pkg/infra/usagestats" "github.com/grafana/grafana/pkg/plugins" "github.com/grafana/grafana/pkg/services/pluginsettings" + "github.com/grafana/grafana/pkg/services/supportbundles" "github.com/grafana/grafana/pkg/setting" ) diff --git a/pkg/infra/supportbundles/supportbundlesimpl/db_collector.go b/pkg/services/supportbundles/supportbundlesimpl/db_collector.go similarity index 97% rename from pkg/infra/supportbundles/supportbundlesimpl/db_collector.go rename to pkg/services/supportbundles/supportbundlesimpl/db_collector.go index de1d593c89b..f4caa6e799d 100644 --- a/pkg/infra/supportbundles/supportbundlesimpl/db_collector.go +++ b/pkg/services/supportbundles/supportbundlesimpl/db_collector.go @@ -6,8 +6,8 @@ import ( "fmt" "github.com/grafana/grafana/pkg/infra/db" - "github.com/grafana/grafana/pkg/infra/supportbundles" "github.com/grafana/grafana/pkg/services/sqlstore/migrator" + "github.com/grafana/grafana/pkg/services/supportbundles" ) func dbCollector(sql db.DB) supportbundles.Collector { diff --git a/pkg/infra/supportbundles/supportbundlesimpl/models.go b/pkg/services/supportbundles/supportbundlesimpl/models.go similarity index 100% rename from pkg/infra/supportbundles/supportbundlesimpl/models.go rename to pkg/services/supportbundles/supportbundlesimpl/models.go diff --git a/pkg/infra/supportbundles/supportbundlesimpl/service.go b/pkg/services/supportbundles/supportbundlesimpl/service.go similarity index 98% rename from pkg/infra/supportbundles/supportbundlesimpl/service.go rename to pkg/services/supportbundles/supportbundlesimpl/service.go index b395394c3cd..83a2abc3ae5 100644 --- a/pkg/infra/supportbundles/supportbundlesimpl/service.go +++ b/pkg/services/supportbundles/supportbundlesimpl/service.go @@ -11,12 +11,12 @@ import ( "github.com/grafana/grafana/pkg/infra/db" "github.com/grafana/grafana/pkg/infra/kvstore" "github.com/grafana/grafana/pkg/infra/log" - "github.com/grafana/grafana/pkg/infra/supportbundles" "github.com/grafana/grafana/pkg/infra/usagestats" "github.com/grafana/grafana/pkg/plugins" ac "github.com/grafana/grafana/pkg/services/accesscontrol" "github.com/grafana/grafana/pkg/services/featuremgmt" "github.com/grafana/grafana/pkg/services/pluginsettings" + "github.com/grafana/grafana/pkg/services/supportbundles" "github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/setting" ) diff --git a/pkg/infra/supportbundles/supportbundlesimpl/service_bundle.go b/pkg/services/supportbundles/supportbundlesimpl/service_bundle.go similarity index 98% rename from pkg/infra/supportbundles/supportbundlesimpl/service_bundle.go rename to pkg/services/supportbundles/supportbundlesimpl/service_bundle.go index 86fe79f5ae4..0bdc492471b 100644 --- a/pkg/infra/supportbundles/supportbundlesimpl/service_bundle.go +++ b/pkg/services/supportbundles/supportbundlesimpl/service_bundle.go @@ -10,7 +10,7 @@ import ( "os" "path/filepath" - "github.com/grafana/grafana/pkg/infra/supportbundles" + "github.com/grafana/grafana/pkg/services/supportbundles" ) type bundleResult struct { diff --git a/pkg/infra/supportbundles/supportbundlesimpl/service_test.go b/pkg/services/supportbundles/supportbundlesimpl/service_test.go similarity index 94% rename from pkg/infra/supportbundles/supportbundlesimpl/service_test.go rename to pkg/services/supportbundles/supportbundlesimpl/service_test.go index 0f3325a4753..a2c3176b15e 100644 --- a/pkg/infra/supportbundles/supportbundlesimpl/service_test.go +++ b/pkg/services/supportbundles/supportbundlesimpl/service_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/grafana/grafana/pkg/infra/log" - "github.com/grafana/grafana/pkg/infra/supportbundles" + "github.com/grafana/grafana/pkg/services/supportbundles" "github.com/grafana/grafana/pkg/setting" "github.com/stretchr/testify/require" ) diff --git a/pkg/infra/supportbundles/supportbundlesimpl/store.go b/pkg/services/supportbundles/supportbundlesimpl/store.go similarity index 97% rename from pkg/infra/supportbundles/supportbundlesimpl/store.go rename to pkg/services/supportbundles/supportbundlesimpl/store.go index 9c71c3523b3..01a3fe1becc 100644 --- a/pkg/infra/supportbundles/supportbundlesimpl/store.go +++ b/pkg/services/supportbundles/supportbundlesimpl/store.go @@ -10,7 +10,7 @@ import ( "github.com/google/uuid" "github.com/grafana/grafana/pkg/infra/kvstore" - "github.com/grafana/grafana/pkg/infra/supportbundles" + "github.com/grafana/grafana/pkg/services/supportbundles" "github.com/grafana/grafana/pkg/services/user" ) diff --git a/pkg/infra/supportbundles/supportbundlesimpl/user_collector.go b/pkg/services/supportbundles/supportbundlesimpl/user_collector.go similarity index 94% rename from pkg/infra/supportbundles/supportbundlesimpl/user_collector.go rename to pkg/services/supportbundles/supportbundlesimpl/user_collector.go index b7b5baeea80..5fd22a7f9f6 100644 --- a/pkg/infra/supportbundles/supportbundlesimpl/user_collector.go +++ b/pkg/services/supportbundles/supportbundlesimpl/user_collector.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" - "github.com/grafana/grafana/pkg/infra/supportbundles" + "github.com/grafana/grafana/pkg/services/supportbundles" "github.com/grafana/grafana/pkg/services/user" )