2022-04-08 05:42:33 -05:00
|
|
|
package featuremgmt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/services/featuremgmt/strcase"
|
|
|
|
)
|
|
|
|
|
2023-08-30 10:46:47 -05:00
|
|
|
func (fm *FeatureManager) GetUsageStats(ctx context.Context) map[string]any {
|
2022-04-08 05:42:33 -05:00
|
|
|
enabled := fm.GetEnabled(ctx)
|
2023-08-30 10:46:47 -05:00
|
|
|
stats := make(map[string]any, len(enabled))
|
2022-04-08 05:42:33 -05:00
|
|
|
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))
|
|
|
|
}
|