renames usage state name for auth token

as noted, sessions might not be a good name for this metrics.
while devices would be a better name for users I think we should
align the name with the code as much as possible. The ui listing
all auth_tokens per user should probarbly say "devices" instead
This commit is contained in:
bergquist
2019-02-11 10:50:32 +01:00
parent 2c8c4729a8
commit 3ce99bca66
4 changed files with 9 additions and 9 deletions

View File

@@ -59,15 +59,15 @@ func (uss *UsageStatsService) sendUsageStats(oauthProviders map[string]bool) {
metrics["stats.provisioned_dashboards.count"] = statsQuery.Result.ProvisionedDashboards
metrics["stats.snapshots.count"] = statsQuery.Result.Snapshots
metrics["stats.teams.count"] = statsQuery.Result.Teams
metrics["stats.total_sessions.count"] = statsQuery.Result.Sessions
metrics["stats.total_auth_token.count"] = statsQuery.Result.AuthTokens
userCount := statsQuery.Result.Users
avgSessionsPerUser := statsQuery.Result.Sessions
avgAuthTokensPerUser := statsQuery.Result.AuthTokens
if userCount != 0 {
avgSessionsPerUser = avgSessionsPerUser / userCount
avgAuthTokensPerUser = avgAuthTokensPerUser / userCount
}
metrics["stats.avg_sessions_per_user.count"] = avgSessionsPerUser
metrics["stats.avg_auth_token_per_user.count"] = avgAuthTokensPerUser
dsStats := models.GetDataSourceStatsQuery{}
if err := uss.Bus.Dispatch(&dsStats); err != nil {

View File

@@ -45,7 +45,7 @@ func TestMetrics(t *testing.T) {
ProvisionedDashboards: 12,
Snapshots: 13,
Teams: 14,
Sessions: 15,
AuthTokens: 15,
}
getSystemStatsQuery = query
return nil
@@ -229,8 +229,8 @@ func TestMetrics(t *testing.T) {
So(metrics.Get("stats.provisioned_dashboards.count").MustInt(), ShouldEqual, getSystemStatsQuery.Result.ProvisionedDashboards)
So(metrics.Get("stats.snapshots.count").MustInt(), ShouldEqual, getSystemStatsQuery.Result.Snapshots)
So(metrics.Get("stats.teams.count").MustInt(), ShouldEqual, getSystemStatsQuery.Result.Teams)
So(metrics.Get("stats.total_sessions.count").MustInt64(), ShouldEqual, 15)
So(metrics.Get("stats.avg_sessions_per_user.count").MustInt64(), ShouldEqual, 5)
So(metrics.Get("stats.total_auth_token.count").MustInt64(), ShouldEqual, 15)
So(metrics.Get("stats.avg_auth_token_per_user.count").MustInt64(), ShouldEqual, 5)
So(metrics.Get("stats.ds."+models.DS_ES+".count").MustInt(), ShouldEqual, 9)
So(metrics.Get("stats.ds."+models.DS_PROMETHEUS+".count").MustInt(), ShouldEqual, 10)