mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
UsageStats: track enabled features (#47407)
* #47127: include enabled features in the usage stats reports * #47127: convert feature names to snake cased metric names * #47127: remove dead code * #47127: lint fix * #47127: convert GetUsageStats to return `map[string]interface{}` * #47127: fix testssssssss * #47127: fix testssssssss
This commit is contained in:
21
pkg/services/featuremgmt/usage_stats.go
Normal file
21
pkg/services/featuremgmt/usage_stats.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package featuremgmt
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt/strcase"
|
||||
)
|
||||
|
||||
func (fm *FeatureManager) GetUsageStats(ctx context.Context) map[string]interface{} {
|
||||
enabled := fm.GetEnabled(ctx)
|
||||
stats := make(map[string]interface{}, len(enabled))
|
||||
for featureName := range enabled {
|
||||
stats[asMetricName(featureName)] = 1
|
||||
}
|
||||
return stats
|
||||
}
|
||||
|
||||
func asMetricName(featureName string) string {
|
||||
return fmt.Sprintf("stats.features.%s.count", strcase.ToSnake(featureName))
|
||||
}
|
||||
Reference in New Issue
Block a user