diff options
author | David Lu <david.lu97@outlook.com> | 2016-09-06 18:51:27 -0400 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2016-09-06 19:51:27 -0300 |
commit | 51501f920c092791c7d83ac7067874547a37c96a (patch) | |
tree | 8665cdc82c4fa99ba5c2b6743c66e0912fd53ddb /mattermost.go | |
parent | 47d77d258961f95f4348b4745da062c08731b283 (diff) | |
download | chat-51501f920c092791c7d83ac7067874547a37c96a.tar.gz chat-51501f920c092791c7d83ac7067874547a37c96a.tar.bz2 chat-51501f920c092791c7d83ac7067874547a37c96a.zip |
PLT-3753 Added Segment analytics (#3972)
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() { |