2021-08-25 08:11:22 -05:00
|
|
|
package backgroundsvcs
|
|
|
|
|
|
|
|
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/tracing"
|
2021-09-21 13:50:37 -05:00
|
|
|
uss "github.com/grafana/grafana/pkg/infra/usagestats/service"
|
2022-04-08 06:41:26 -05:00
|
|
|
"github.com/grafana/grafana/pkg/infra/usagestats/statscollector"
|
2022-08-30 12:09:52 -05:00
|
|
|
"github.com/grafana/grafana/pkg/plugins/manager/process"
|
2021-08-25 08:11:22 -05:00
|
|
|
"github.com/grafana/grafana/pkg/registry"
|
|
|
|
"github.com/grafana/grafana/pkg/services/alerting"
|
2022-11-18 02:56:06 -06:00
|
|
|
"github.com/grafana/grafana/pkg/services/auth"
|
2021-08-25 08:11:22 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/cleanup"
|
2021-09-01 06:05:15 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/dashboardsnapshots"
|
2022-09-26 15:25:34 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/grpcserver"
|
2022-03-03 08:05:47 -06:00
|
|
|
"github.com/grafana/grafana/pkg/services/guardian"
|
2023-02-08 02:32:59 -06:00
|
|
|
ldapapi "github.com/grafana/grafana/pkg/services/ldap/api"
|
2021-08-25 08:11:22 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/live"
|
|
|
|
"github.com/grafana/grafana/pkg/services/live/pushhttp"
|
2022-07-21 12:11:35 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/login/authinfoservice"
|
2022-11-22 04:37:18 -06:00
|
|
|
"github.com/grafana/grafana/pkg/services/loginattempt/loginattemptimpl"
|
2021-08-25 08:11:22 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/ngalert"
|
|
|
|
"github.com/grafana/grafana/pkg/services/notifications"
|
2022-03-10 11:38:04 -06:00
|
|
|
plugindashboardsservice "github.com/grafana/grafana/pkg/services/plugindashboards/service"
|
2021-08-25 08:11:22 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/provisioning"
|
2023-04-11 12:36:50 -05:00
|
|
|
publicdashboardsmetric "github.com/grafana/grafana/pkg/services/publicdashboards/metric"
|
2021-08-25 08:11:22 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/rendering"
|
2022-04-27 03:29:39 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/searchV2"
|
2022-09-06 14:21:25 -05:00
|
|
|
secretsMigrations "github.com/grafana/grafana/pkg/services/secrets/kvstore/migrations"
|
2021-12-27 11:04:47 -06:00
|
|
|
secretsManager "github.com/grafana/grafana/pkg/services/secrets/manager"
|
2021-11-11 09:10:24 -06:00
|
|
|
"github.com/grafana/grafana/pkg/services/serviceaccounts"
|
2022-07-07 09:03:16 -05:00
|
|
|
samanager "github.com/grafana/grafana/pkg/services/serviceaccounts/manager"
|
2022-03-17 12:19:23 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/store"
|
2022-11-30 15:42:42 -06:00
|
|
|
"github.com/grafana/grafana/pkg/services/store/entity"
|
2022-07-07 06:32:18 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/store/sanitizer"
|
2023-01-04 10:33:18 -06:00
|
|
|
"github.com/grafana/grafana/pkg/services/supportbundles/supportbundlesimpl"
|
2021-11-01 04:53:33 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/updatechecker"
|
2021-08-25 08:11:22 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func ProvideBackgroundServiceRegistry(
|
2022-01-31 09:06:16 -06:00
|
|
|
httpServer *api.HTTPServer, ng *ngalert.AlertNG, cleanup *cleanup.CleanUpService, live *live.GrafanaLive,
|
2022-08-30 12:09:52 -05:00
|
|
|
pushGateway *pushhttp.Gateway, notifications *notifications.NotificationService, processManager *process.Manager,
|
2022-11-18 02:56:06 -06:00
|
|
|
rendering *rendering.RenderingService, tokenService auth.UserTokenBackgroundService, tracing tracing.Tracer,
|
2022-01-31 09:06:16 -06:00
|
|
|
provisioning *provisioning.ProvisioningServiceImpl, alerting *alerting.AlertEngine, usageStats *uss.UsageStats,
|
2022-04-08 06:41:26 -05:00
|
|
|
statsCollector *statscollector.Service, grafanaUpdateChecker *updatechecker.GrafanaService,
|
|
|
|
pluginsUpdateChecker *updatechecker.PluginsService, metrics *metrics.InternalMetricsService,
|
2023-04-13 12:42:24 -05:00
|
|
|
secretsService *secretsManager.SecretsService, remoteCache *remotecache.RemoteCache, StorageService store.StorageService, searchService searchV2.SearchService, entityEventsService store.EntityEventsService,
|
2022-07-21 12:11:35 -05:00
|
|
|
saService *samanager.ServiceAccountsService, authInfoService *authinfoservice.Implementation,
|
2022-12-20 04:13:37 -06:00
|
|
|
grpcServerProvider grpcserver.Provider, secretMigrationProvider secretsMigrations.SecretMigrationProvider, loginAttemptService *loginattemptimpl.Service,
|
|
|
|
bundleService *supportbundlesimpl.Service,
|
2023-04-11 12:36:50 -05:00
|
|
|
publicDashboardsMetric *publicdashboardsmetric.Service,
|
2021-08-25 08:11:22 -05:00
|
|
|
// Need to make sure these are initialized, is there a better place to put them?
|
2022-06-14 12:41:29 -05:00
|
|
|
_ dashboardsnapshots.Service, _ *alerting.AlertNotificationService,
|
2022-03-10 11:38:04 -06:00
|
|
|
_ serviceaccounts.Service, _ *guardian.Provider,
|
2022-07-07 06:32:18 -05:00
|
|
|
_ *plugindashboardsservice.DashboardUpdater, _ *sanitizer.Provider,
|
2023-02-08 02:32:59 -06:00
|
|
|
_ *grpcserver.HealthService, _ entity.EntityStoreServer, _ *grpcserver.ReflectionService, _ *ldapapi.Service,
|
2021-08-25 08:11:22 -05:00
|
|
|
) *BackgroundServiceRegistry {
|
|
|
|
return NewBackgroundServiceRegistry(
|
|
|
|
httpServer,
|
|
|
|
ng,
|
|
|
|
cleanup,
|
|
|
|
live,
|
|
|
|
pushGateway,
|
|
|
|
notifications,
|
|
|
|
rendering,
|
|
|
|
tokenService,
|
|
|
|
provisioning,
|
|
|
|
alerting,
|
2022-01-31 09:06:16 -06:00
|
|
|
grafanaUpdateChecker,
|
|
|
|
pluginsUpdateChecker,
|
2021-08-25 08:11:22 -05:00
|
|
|
metrics,
|
|
|
|
usageStats,
|
2022-04-08 06:41:26 -05:00
|
|
|
statsCollector,
|
2021-08-25 08:11:22 -05:00
|
|
|
tracing,
|
2021-12-27 11:04:47 -06:00
|
|
|
remoteCache,
|
2022-02-10 12:45:00 -06:00
|
|
|
secretsService,
|
2022-03-17 12:19:23 -05:00
|
|
|
StorageService,
|
2022-04-27 03:29:39 -05:00
|
|
|
searchService,
|
|
|
|
entityEventsService,
|
2022-09-26 15:25:34 -05:00
|
|
|
grpcServerProvider,
|
2022-07-07 09:03:16 -05:00
|
|
|
saService,
|
2022-07-21 12:11:35 -05:00
|
|
|
authInfoService,
|
2022-08-30 12:09:52 -05:00
|
|
|
processManager,
|
2022-09-06 14:21:25 -05:00
|
|
|
secretMigrationProvider,
|
2022-11-22 04:37:18 -06:00
|
|
|
loginAttemptService,
|
2022-12-20 04:13:37 -06:00
|
|
|
bundleService,
|
2023-04-11 12:36:50 -05:00
|
|
|
publicDashboardsMetric,
|
2022-04-08 06:41:26 -05:00
|
|
|
)
|
2021-08-25 08:11:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// BackgroundServiceRegistry provides background services.
|
|
|
|
type BackgroundServiceRegistry struct {
|
|
|
|
Services []registry.BackgroundService
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewBackgroundServiceRegistry(services ...registry.BackgroundService) *BackgroundServiceRegistry {
|
|
|
|
return &BackgroundServiceRegistry{services}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *BackgroundServiceRegistry) GetServices() []registry.BackgroundService {
|
|
|
|
return r.Services
|
|
|
|
}
|