Plugins: Refactor Grafana and Plugin version update checkers (#44529)

* refactor

* rework plugin update checking

* make smarter

* simplify

* fix linter issue

* make use of mutex

* apply feedback to simplify

* format imports

* fix tests
This commit is contained in:
Will Browne
2022-01-31 16:06:16 +01:00
committed by GitHub
parent bf8694e709
commit 76603b93d6
14 changed files with 559 additions and 270 deletions
@@ -26,12 +26,13 @@ import (
)
func ProvideBackgroundServiceRegistry(
httpServer *api.HTTPServer, ng *ngalert.AlertNG, cleanup *cleanup.CleanUpService,
live *live.GrafanaLive, pushGateway *pushhttp.Gateway, notifications *notifications.NotificationService,
rendering *rendering.RenderingService, tokenService models.UserTokenBackgroundService,
provisioning *provisioning.ProvisioningServiceImpl, alerting *alerting.AlertEngine, pm *manager.PluginManager,
metrics *metrics.InternalMetricsService, usageStats *uss.UsageStats, updateChecker *updatechecker.Service,
tracing tracing.Tracer, remoteCache *remotecache.RemoteCache, secretsService *secretsManager.SecretsService,
httpServer *api.HTTPServer, ng *ngalert.AlertNG, cleanup *cleanup.CleanUpService, live *live.GrafanaLive,
pushGateway *pushhttp.Gateway, notifications *notifications.NotificationService, pm *manager.PluginManager,
rendering *rendering.RenderingService, tokenService models.UserTokenBackgroundService, tracing tracing.Tracer,
provisioning *provisioning.ProvisioningServiceImpl, alerting *alerting.AlertEngine, usageStats *uss.UsageStats,
grafanaUpdateChecker *updatechecker.GrafanaService, pluginsUpdateChecker *updatechecker.PluginsService,
metrics *metrics.InternalMetricsService, secretsService *secretsManager.SecretsService,
remoteCache *remotecache.RemoteCache,
// Need to make sure these are initialized, is there a better place to put them?
_ *plugindashboards.Service, _ *dashboardsnapshots.Service, _ *pluginsettings.Service,
_ *alerting.AlertNotificationService, _ serviceaccounts.Service,
@@ -48,7 +49,8 @@ func ProvideBackgroundServiceRegistry(
provisioning,
alerting,
pm,
updateChecker,
grafanaUpdateChecker,
pluginsUpdateChecker,
metrics,
usageStats,
tracing,
+2 -1
View File
@@ -109,7 +109,8 @@ var wireBasicSet = wire.NewSet(
hooks.ProvideService,
kvstore.ProvideService,
localcache.ProvideService,
updatechecker.ProvideService,
updatechecker.ProvideGrafanaService,
updatechecker.ProvidePluginsService,
uss.ProvideService,
wire.Bind(new(usagestats.Service), new(*uss.UsageStats)),
manager.ProvideService,