diff options
author | George Goldberg <george@gberg.me> | 2018-06-05 18:19:20 +0100 |
---|---|---|
committer | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2018-06-05 19:19:20 +0200 |
commit | 5e36cbae09082d830ea4beb4f3049243d23121a1 (patch) | |
tree | 88b78a3f740ffe1a33fcfa84066de8458edbf802 /app/diagnostics.go | |
parent | fb00ce951efb3234ff8d1e8ab528bc6995d60489 (diff) | |
download | chat-5e36cbae09082d830ea4beb4f3049243d23121a1.tar.gz chat-5e36cbae09082d830ea4beb4f3049243d23121a1.tar.bz2 chat-5e36cbae09082d830ea4beb4f3049243d23121a1.zip |
Include the daily and monthly active user counts in telemetry. (#8887)
Diffstat (limited to 'app/diagnostics.go')
-rw-r--r-- | app/diagnostics.go | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/app/diagnostics.go b/app/diagnostics.go index 2c1fe64ab..c1b3a015a 100644 --- a/app/diagnostics.go +++ b/app/diagnostics.go @@ -119,7 +119,8 @@ func pluginActivated(pluginStates map[string]*model.PluginState, pluginId string func (a *App) trackActivity() { var userCount int64 - var activeUserCount int64 + var activeUsersDailyCount int64 + var activeUsersMonthlyCount int64 var inactiveUserCount int64 var teamCount int64 var publicChannelCount int64 @@ -129,12 +130,19 @@ func (a *App) trackActivity() { var deletedPrivateChannelCount int64 var postsCount int64 - if ucr := <-a.Srv.Store.User().GetTotalUsersCount(); ucr.Err == nil { - userCount = ucr.Data.(int64) + dailyActiveChan := a.Srv.Store.User().AnalyticsActiveCount(DAY_MILLISECONDS) + monthlyActiveChan := a.Srv.Store.User().AnalyticsActiveCount(MONTH_MILLISECONDS) + + if r := <-dailyActiveChan; r.Err == nil { + activeUsersDailyCount = r.Data.(int64) } - if ucr := <-a.Srv.Store.Status().GetTotalActiveUsersCount(); ucr.Err == nil { - activeUserCount = ucr.Data.(int64) + if r := <-monthlyActiveChan; r.Err == nil { + activeUsersMonthlyCount = r.Data.(int64) + } + + if ucr := <-a.Srv.Store.User().GetTotalUsersCount(); ucr.Err == nil { + userCount = ucr.Data.(int64) } if iucr := <-a.Srv.Store.User().AnalyticsGetInactiveUsersCount(); iucr.Err == nil { @@ -171,7 +179,8 @@ func (a *App) trackActivity() { a.SendDiagnostic(TRACK_ACTIVITY, map[string]interface{}{ "registered_users": userCount, - "active_users": activeUserCount, + "active_users_daily": activeUsersDailyCount, + "active_users_monthly": activeUsersMonthlyCount, "registered_deactivated_users": inactiveUserCount, "teams": teamCount, "public_channels": publicChannelCount, |