mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
FeatureToggles: Write enabled flags to the logs on startup (#87225)
This commit is contained in:
parent
281d785442
commit
b7df129b78
@ -1,8 +1,11 @@
|
||||
package featuremgmt
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
@ -57,6 +60,15 @@ func ProvideManagerService(cfg *setting.Cfg) (*FeatureManager, error) {
|
||||
// update the values
|
||||
mgmt.update()
|
||||
|
||||
// Log the enabled feature toggles at startup
|
||||
enabled := sort.StringSlice(maps.Keys(mgmt.enabled))
|
||||
logctx := make([]any, len(enabled)*2)
|
||||
for i, k := range enabled {
|
||||
logctx[(i * 2)] = k
|
||||
logctx[(i*2)+1] = true
|
||||
}
|
||||
mgmt.log.Info("FeatureToggles", logctx...)
|
||||
|
||||
// Minimum approach to avoid circular dependency
|
||||
// nolint:staticcheck
|
||||
cfg.IsFeatureToggleEnabled = mgmt.IsEnabledGlobally
|
||||
|
Loading…
Reference in New Issue
Block a user