Documentation ¶
Overview ¶
Server defines the main entrypoints to Grafana and the Grafana CLI, as well as test environments. OSS and Enterprise-specific build tags are used in this package to control wire dependencies for each build.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
Types ¶
type ModuleRunner ¶
type ModuleRunner struct { Cfg *setting.Cfg SettingsProvider setting.Provider Features featuremgmt.FeatureToggles }
ModuleRunner is a simplified version of Runner that is used in the grafana server target command. It has a minimal set of dependencies required to launch background/dskit services.
func NewModuleRunner ¶
func NewModuleRunner(cfg *setting.Cfg, settingsProvider setting.Provider, features featuremgmt.FeatureToggles, ) ModuleRunner
type ModuleServer ¶
type ModuleServer struct {
// contains filtered or unexported fields
}
ModuleServer is responsible for managing the lifecycle of dskit services. The ModuleServer has the minimal set of dependencies to launch dskit services, but it can be used to launch the entire Grafana server.
func NewModule ¶
func NewModule(opts Options, apiOpts api.ServerOptions, features featuremgmt.FeatureToggles, cfg *setting.Cfg) (*ModuleServer, error)
NewModule returns an instance of a ModuleServer, responsible for managing dskit modules (services).
func (*ModuleServer) Run ¶
func (s *ModuleServer) Run() error
Run initializes and starts services. This will block until all services have exited. To initiate shutdown, call the Shutdown method in another goroutine.
type Options ¶
type Options struct { HomePath string PidFile string Version string Commit string BuildBranch string Listener net.Listener }
Options contains parameters for the New function.
type Runner ¶
type Runner struct { Cfg *setting.Cfg SQLStore db.DB SettingsProvider setting.Provider Features featuremgmt.FeatureToggles EncryptionService encryption.Internal SecretsService *manager.SecretsService SecretsMigrator secrets.Migrator UserService user.Service }
func NewRunner ¶
func NewRunner(cfg *setting.Cfg, sqlStore db.DB, settingsProvider setting.Provider, encryptionService encryption.Internal, features featuremgmt.FeatureToggles, secretsService *manager.SecretsService, secretsMigrator secrets.Migrator, userService user.Service, ) Runner
type Server ¶
type Server struct { HTTPServer *api.HTTPServer // contains filtered or unexported fields }
Server is responsible for managing the lifecycle of services. This is the core Server implementation which starts the entire Grafana server. Use ModuleServer to launch specific modules.
func New ¶
func New(opts Options, cfg *setting.Cfg, httpServer *api.HTTPServer, roleRegistry accesscontrol.RoleRegistry, provisioningService provisioning.ProvisioningService, backgroundServiceProvider registry.BackgroundServiceRegistry, usageStatsProvidersRegistry registry.UsageStatsProvidersRegistry, statsCollectorService *statscollector.Service, promReg prometheus.Registerer, ) (*Server, error)
New returns a new instance of Server.
type TestEnv ¶
type TestEnv struct { Server *Server SQLStore db.DB Cfg *setting.Cfg NotificationService *notifications.NotificationServiceMock GRPCServer grpcserver.Provider PluginRegistry registry.Service HTTPClientProvider httpclient.Provider OAuthTokenService *oauthtokentest.Service RequestMiddleware web.Middleware FeatureToggles featuremgmt.FeatureToggles }
func ProvideTestEnv ¶
func ProvideTestEnv( server *Server, db db.DB, cfg *setting.Cfg, ns *notifications.NotificationServiceMock, grpcServer grpcserver.Provider, pluginRegistry registry.Service, httpClientProvider httpclient.Provider, oAuthTokenService *oauthtokentest.Service, featureMgmt featuremgmt.FeatureToggles, ) (*TestEnv, error)