Prometheus Metrics: Add missing stat_total_teams metric (#65133)

* Prometheus Metrics: Add missing stat_total_teams metric
This commit is contained in:
Gabriel MABILLE 2023-03-22 09:14:43 +01:00 committed by GitHub
parent 8941ca813c
commit 895d4cc60b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -143,6 +143,9 @@ var (
// MStatTotalUsers is a metric total amount of users
MStatTotalUsers prometheus.Gauge
// MStatTotalTeams is a metric total amount of teams
MStatTotalTeams prometheus.Gauge
// MStatActiveUsers is a metric number of active users
MStatActiveUsers prometheus.Gauge
@ -445,6 +448,12 @@ func init() {
Namespace: ExporterName,
})
MStatTotalTeams = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "stat_total_teams",
Help: "total amount of teams",
Namespace: ExporterName,
})
MStatActiveUsers = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "stat_active_users",
Help: "number of active users",
@ -661,6 +670,7 @@ func initMetricVars() {
MStatTotalDashboards,
MStatTotalFolders,
MStatTotalUsers,
MStatTotalTeams,
MStatActiveUsers,
MStatTotalOrgs,
MStatTotalPlaylists,

View File

@ -312,6 +312,7 @@ func (s *Service) updateTotalStats(ctx context.Context) bool {
metrics.MStatTotalDashboards.Set(float64(statsQuery.Result.Dashboards))
metrics.MStatTotalFolders.Set(float64(statsQuery.Result.Folders))
metrics.MStatTotalUsers.Set(float64(statsQuery.Result.Users))
metrics.MStatTotalTeams.Set(float64(statsQuery.Result.Teams))
metrics.MStatActiveUsers.Set(float64(statsQuery.Result.ActiveUsers))
metrics.MStatTotalPlaylists.Set(float64(statsQuery.Result.Playlists))
metrics.MStatTotalOrgs.Set(float64(statsQuery.Result.Orgs))