diff --git a/pkg/registry/registry.go b/pkg/registry/registry.go index e597a06f15f..7685e91923d 100644 --- a/pkg/registry/registry.go +++ b/pkg/registry/registry.go @@ -34,12 +34,23 @@ func GetServices() []*Descriptor { return services } +// Service interface is the lowest common shape that services +// are expected to forfill to be started within Grafana. type Service interface { + + // Init is called by Grafana main process which gives the service + // the possibility do some initial work before its started. Things + // like adding routes, bus handlers should be done in the Init function Init() error } -// Useful for alerting service +// CanBeDisabled allows the services to decide if it should +// be started or not by itself. This is useful for services +// that might not always be started, ex alerting. +// This will be called after `Init()`. type CanBeDisabled interface { + + // IsDisabled should return a bool saying if it can be started or not. IsDisabled() bool }