diff options
Diffstat (limited to 'mattermost.go')
-rw-r--r-- | mattermost.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/mattermost.go b/mattermost.go index 391c76096..6d6130604 100644 --- a/mattermost.go +++ b/mattermost.go @@ -279,6 +279,47 @@ func doSecurityAndDiagnostics() { } } } + + if *utils.Cfg.LogSettings.EnableDiagnostics { + utils.SendGeneralDiagnostics() + sendServerDiagnostics() + } +} + +func sendServerDiagnostics() { + var userCount int64 + var activeUserCount int64 + var teamCount int64 + + if ucr := <-api.Srv.Store.User().GetTotalUsersCount(); ucr.Err == nil { + userCount = ucr.Data.(int64) + } + + if ucr := <-api.Srv.Store.Status().GetTotalActiveUsersCount(); ucr.Err == nil { + activeUserCount = ucr.Data.(int64) + } + + if tcr := <-api.Srv.Store.Team().AnalyticsTeamCount(); tcr.Err == nil { + teamCount = tcr.Data.(int64) + } + + utils.SendDiagnostic(utils.TRACK_ACTIVITY, map[string]interface{}{ + "users": userCount, + "active_users": activeUserCount, + "teams": teamCount, + }) + + edition := model.BuildEnterpriseReady + version := model.CurrentVersion + database := utils.Cfg.SqlSettings.DriverName + operatingSystem := runtime.GOOS + + utils.SendDiagnostic(utils.TRACK_VERSION, map[string]interface{}{ + "edition": edition, + "version": version, + "database": database, + "operating_system": operatingSystem, + }) } func runSecurityAndDiagnosticsJob() { |