Adding guest accounts count telemetry (#14257)

* Adding guest accounts count telemetry

* Adding missed methods to the opentracing an timer layer
Этот коммит содержится в:
Jesús Espino
2020-04-09 11:05:43 +02:00
коммит произвёл GitHub
родитель 819f57037b
Коммит f6f025aeaa
7 изменённых файлов: 245 добавлений и 0 удалений

Просмотреть файл

@@ -1489,6 +1489,22 @@ func (s *TimerLayerChannelStore) RemoveMember(channelId string, userId string) *
return resultVar0
}
func (s *TimerLayerChannelStore) RemoveMembers(channelId string, userIds []string) *model.AppError {
start := timemodule.Now()
resultVar0 := s.ChannelStore.RemoveMembers(channelId, userIds)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar0 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.RemoveMembers", success, elapsed)
}
return resultVar0
}
func (s *TimerLayerChannelStore) ResetAllChannelSchemes() *model.AppError {
start := timemodule.Now()
@@ -4924,6 +4940,38 @@ func (s *TimerLayerRoleStore) Save(role *model.Role) (*model.Role, *model.AppErr
return resultVar0, resultVar1
}
func (s *TimerLayerSchemeStore) CountByScope(scope string) (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.SchemeStore.CountByScope(scope)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("SchemeStore.CountByScope", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerSchemeStore) CountWithoutPermission(scope string, permissionID string, roleScope model.RoleScope, roleType model.RoleType) (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.SchemeStore.CountWithoutPermission(scope, permissionID, roleScope, roleType)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("SchemeStore.CountWithoutPermission", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerSchemeStore) Delete(schemeId string) (*model.Scheme, *model.AppError) {
start := timemodule.Now()
@@ -6025,6 +6073,22 @@ func (s *TimerLayerTeamStore) RemoveMember(teamId string, userId string) *model.
return resultVar0
}
func (s *TimerLayerTeamStore) RemoveMembers(teamId string, userIds []string) *model.AppError {
start := timemodule.Now()
resultVar0 := s.TeamStore.RemoveMembers(teamId, userIds)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar0 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.RemoveMembers", success, elapsed)
}
return resultVar0
}
func (s *TimerLayerTeamStore) ResetAllTeamSchemes() *model.AppError {
start := timemodule.Now()
@@ -6392,6 +6456,22 @@ func (s *TimerLayerUserStore) AnalyticsActiveCount(time int64, options model.Use
return resultVar0, resultVar1
}
func (s *TimerLayerUserStore) AnalyticsGetGuestCount() (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.UserStore.AnalyticsGetGuestCount()
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("UserStore.AnalyticsGetGuestCount", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerUserStore) AnalyticsGetInactiveUsersCount() (int64, *model.AppError) {
start := timemodule.Now()