Live: remove feature toggle and enable by default (#33654)

This commit is contained in:
Ryan McKinley
2021-05-04 08:44:55 -07:00
committed by GitHub
parent 9315152d4f
commit 33e4f8d7ac
11 changed files with 35 additions and 63 deletions
+1 -14
View File
@@ -115,7 +115,7 @@ func (g *GrafanaLive) getStreamPlugin(pluginID string) (backend.StreamHandler, e
// AddMigration defines database migrations.
// This is an implementation of registry.DatabaseMigrator.
func (g *GrafanaLive) AddMigration(mg *migrator.Migrator) {
if !g.IsEnabled() {
if g == nil || g.Cfg == nil || !g.Cfg.IsLiveConfigEnabled() {
return
}
database.AddLiveChannelMigrations(mg)
@@ -136,11 +136,6 @@ var clientConcurrency = 8
func (g *GrafanaLive) Init() error {
logger.Debug("GrafanaLive initialization")
if !g.IsEnabled() {
logger.Debug("GrafanaLive feature not enabled, skipping initialization")
return nil
}
// We use default config here as starting point. Default config contains
// reasonable values for available options.
cfg := centrifuge.DefaultConfig
@@ -530,14 +525,6 @@ func (g *GrafanaLive) ClientCount(channel string) (int, error) {
return len(p.Presence), nil
}
// IsEnabled returns true if the Grafana Live feature is enabled.
func (g *GrafanaLive) IsEnabled() bool {
if g == nil || g.Cfg == nil {
return false
}
return g.Cfg.IsLiveEnabled()
}
func (g *GrafanaLive) HandleHTTPPublish(ctx *models.ReqContext, cmd dtos.LivePublishCmd) response.Response {
addr := live.ParseChannel(cmd.Channel)
if !addr.IsValid() {
-14
View File
@@ -34,30 +34,16 @@ type Gateway struct {
func (g *Gateway) Init() error {
logger.Info("Telemetry Gateway initialization")
if !g.IsEnabled() {
logger.Debug("Telemetry Gateway not enabled, skipping initialization")
return nil
}
g.converter = convert.NewConverter()
return nil
}
// Run Gateway.
func (g *Gateway) Run(ctx context.Context) error {
if !g.IsEnabled() {
logger.Debug("GrafanaLive feature not enabled, skipping initialization of Telemetry Gateway")
return nil
}
<-ctx.Done()
return ctx.Err()
}
// IsEnabled returns true if the Grafana Live feature is enabled.
func (g *Gateway) IsEnabled() bool {
return g.Cfg.IsLiveEnabled() // turn on when Live on for now.
}
func (g *Gateway) Handle(ctx *models.ReqContext) {
streamID := ctx.Params(":streamId")