Skip to content

Commit

Permalink
[MM-58393] server/plugin: ensure metrics are enabled on server (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
isacikgoz authored Aug 14, 2024
1 parent a7e66a8 commit a22aecc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ func (p *Plugin) OnActivate() error {
p.singletonLockAcquired = true
}

// The metrics plugin is dependent on the metrics endpoint being expoesed, so we need to ensure it is enabled.
if cfg := p.API.GetUnsanitizedConfig(); cfg.MetricsSettings.Enable == nil || !*cfg.MetricsSettings.Enable {
if lic := p.API.GetLicense(); lic != nil && *lic.Features.Metrics {
p.API.LogInfo("Enabling metrics...")
cfg.MetricsSettings.Enable = mmModel.NewBool(true)
if err2 := p.API.SaveConfig(cfg); err2 != nil {
return fmt.Errorf("failed to save config: %w", err2)
}
}
}

p.closeChan = make(chan bool)
p.waitGroup = sync.WaitGroup{}

Expand Down

0 comments on commit a22aecc

Please sign in to comment.