From 895d4cc60bf852c5e811a18fe2ba86d2cc40aad9 Mon Sep 17 00:00:00 2001 From: Gabriel MABILLE Date: Wed, 22 Mar 2023 09:14:43 +0100 Subject: [PATCH] Prometheus Metrics: Add missing stat_total_teams metric (#65133) * Prometheus Metrics: Add missing stat_total_teams metric --- pkg/infra/metrics/metrics.go | 10 ++++++++++ pkg/infra/usagestats/statscollector/service.go | 1 + 2 files changed, 11 insertions(+) diff --git a/pkg/infra/metrics/metrics.go b/pkg/infra/metrics/metrics.go index 14e75c1fd30..c744a4b826c 100644 --- a/pkg/infra/metrics/metrics.go +++ b/pkg/infra/metrics/metrics.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, diff --git a/pkg/infra/usagestats/statscollector/service.go b/pkg/infra/usagestats/statscollector/service.go index feaf31bdd81..b2ac2af4494 100644 --- a/pkg/infra/usagestats/statscollector/service.go +++ b/pkg/infra/usagestats/statscollector/service.go @@ -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))