Usagestats: Add interface for stats for user.Service and add Usagestats for case_insensitive_login (#66742)

* add interface for stats

* add user service to registry
This commit is contained in:
Eric Leijonmarck
2023-04-18 14:34:40 +01:00
committed by GitHub
parent 75fc678d8a
commit 6b8c77c70c
4 changed files with 22 additions and 0 deletions
+11
View File
@@ -67,6 +67,17 @@ func ProvideService(
return s, nil
}
func (s *Service) GetUsageStats(ctx context.Context) map[string]interface{} {
stats := map[string]interface{}{}
caseInsensitiveLoginVal := 0
if s.cfg.CaseInsensitiveLogin {
caseInsensitiveLoginVal = 1
}
stats["stats.case_insensitive_login.count"] = caseInsensitiveLoginVal
return stats
}
func (s *Service) Usage(ctx context.Context, _ *quota.ScopeParameters) (*quota.Map, error) {
u := &quota.Map{}
if used, err := s.store.Count(ctx); err != nil {