Prometheus Metrics: Add missing stat_total_teams metric (#65133)

* Prometheus Metrics: Add missing stat_total_teams metric
pull/65164/head
Gabriel MABILLE 3 years ago committed by GitHub
parent 8941ca813c
commit 895d4cc60b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      pkg/infra/metrics/metrics.go
  2. 1
      pkg/infra/usagestats/statscollector/service.go

@ -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,

@ -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))

Loading…
Cancel
Save