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"
|
|
|
|
"github.com/grafana/grafana/pkg/infra/usagestats"
|
|
|
|
"github.com/grafana/grafana/pkg/models"
|
|
|
|
backendmanager "github.com/grafana/grafana/pkg/plugins/backendplugin/manager"
|
|
|
|
"github.com/grafana/grafana/pkg/plugins/manager"
|
|
|
|
"github.com/grafana/grafana/pkg/plugins/plugindashboards"
|
|
|
|
"github.com/grafana/grafana/pkg/registry"
|
|
|
|
"github.com/grafana/grafana/pkg/services/alerting"
|
|
|
|
"github.com/grafana/grafana/pkg/services/cleanup"
|
2021-09-01 06:05:15 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/dashboardsnapshots"
|
2021-08-25 08:11:22 -05:00
|
|
|
"github.com/grafana/grafana/pkg/services/live"
|
|
|
|
"github.com/grafana/grafana/pkg/services/live/pushhttp"
|
|
|
|
"github.com/grafana/grafana/pkg/services/ngalert"
|
|
|
|
"github.com/grafana/grafana/pkg/services/notifications"
|
|
|
|
"github.com/grafana/grafana/pkg/services/provisioning"
|
|
|
|
"github.com/grafana/grafana/pkg/services/rendering"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/azuremonitor"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/cloudwatch"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/elasticsearch"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/graphite"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/influxdb"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/loki"
|
2021-09-07 02:35:37 -05:00
|
|
|
"github.com/grafana/grafana/pkg/tsdb/mssql"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/mysql"
|
2021-08-25 08:11:22 -05:00
|
|
|
"github.com/grafana/grafana/pkg/tsdb/opentsdb"
|
2021-09-07 02:35:37 -05:00
|
|
|
"github.com/grafana/grafana/pkg/tsdb/postgres"
|
2021-08-25 08:11:22 -05:00
|
|
|
"github.com/grafana/grafana/pkg/tsdb/prometheus"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/tempo"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/testdatasource"
|
|
|
|
)
|
|
|
|
|
|
|
|
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,
|
|
|
|
backendPM *backendmanager.Manager, metrics *metrics.InternalMetricsService,
|
|
|
|
usageStats *usagestats.UsageStatsService, tracing *tracing.TracingService, remoteCache *remotecache.RemoteCache,
|
|
|
|
// Need to make sure these are initialized, is there a better place to put them?
|
2021-09-01 06:05:15 -05:00
|
|
|
_ *azuremonitor.Service, _ *cloudwatch.CloudWatchService, _ *elasticsearch.Service, _ *graphite.Service,
|
|
|
|
_ *influxdb.Service, _ *loki.Service, _ *opentsdb.Service, _ *prometheus.Service, _ *tempo.Service,
|
|
|
|
_ *testdatasource.TestDataPlugin, _ *plugindashboards.Service, _ *dashboardsnapshots.Service,
|
2021-09-07 02:35:37 -05:00
|
|
|
_ *postgres.Service, _ *mysql.Service, _ *mssql.Service,
|
2021-08-25 08:11:22 -05:00
|
|
|
|
|
|
|
) *BackgroundServiceRegistry {
|
|
|
|
return NewBackgroundServiceRegistry(
|
|
|
|
httpServer,
|
|
|
|
ng,
|
|
|
|
cleanup,
|
|
|
|
live,
|
|
|
|
pushGateway,
|
|
|
|
notifications,
|
|
|
|
rendering,
|
|
|
|
tokenService,
|
|
|
|
provisioning,
|
|
|
|
alerting,
|
|
|
|
pm,
|
|
|
|
backendPM,
|
|
|
|
metrics,
|
|
|
|
usageStats,
|
|
|
|
tracing,
|
|
|
|
remoteCache)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|