aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorRomain <romdum@users.noreply.github.com>2021-10-02 03:32:15 +0200
committerGitHub <noreply@github.com>2021-10-02 03:32:15 +0200
commitc64e2a319fcbff2dc2f5d5d62570928394c89d08 (patch)
tree547678c6b5d626fddaeb82df76cd091149491756 /modules
parent5b2b2cf92365670d6f47a3a307e2f8715b30de7f (diff)
downloadgitea-c64e2a319fcbff2dc2f5d5d62570928394c89d08.tar.gz
gitea-c64e2a319fcbff2dc2f5d5d62570928394c89d08.zip
Add projects and project boards in exposed metrics (#17202)
* Add projects and project boards in exposed metrics * Refactor db.GetEngine Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'modules')
-rwxr-xr-xmodules/metrics/collector.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/metrics/collector.go b/modules/metrics/collector.go
index f906b58f7d..29374583d6 100755
--- a/modules/metrics/collector.go
+++ b/modules/metrics/collector.go
@@ -30,6 +30,8 @@ type Collector struct {
Mirrors *prometheus.Desc
Oauths *prometheus.Desc
Organizations *prometheus.Desc
+ Projects *prometheus.Desc
+ ProjectBoards *prometheus.Desc
PublicKeys *prometheus.Desc
Releases *prometheus.Desc
Repositories *prometheus.Desc
@@ -119,6 +121,16 @@ func NewCollector() Collector {
"Number of Organizations",
nil, nil,
),
+ Projects: prometheus.NewDesc(
+ namespace+"projects",
+ "Number of projects",
+ nil, nil,
+ ),
+ ProjectBoards: prometheus.NewDesc(
+ namespace+"projects_boards",
+ "Number of project boards",
+ nil, nil,
+ ),
PublicKeys: prometheus.NewDesc(
namespace+"publickeys",
"Number of PublicKeys",
@@ -185,6 +197,8 @@ func (c Collector) Describe(ch chan<- *prometheus.Desc) {
ch <- c.Mirrors
ch <- c.Oauths
ch <- c.Organizations
+ ch <- c.Projects
+ ch <- c.ProjectBoards
ch <- c.PublicKeys
ch <- c.Releases
ch <- c.Repositories
@@ -276,6 +290,16 @@ func (c Collector) Collect(ch chan<- prometheus.Metric) {
float64(stats.Counter.Org),
)
ch <- prometheus.MustNewConstMetric(
+ c.Projects,
+ prometheus.GaugeValue,
+ float64(stats.Counter.Project),
+ )
+ ch <- prometheus.MustNewConstMetric(
+ c.ProjectBoards,
+ prometheus.GaugeValue,
+ float64(stats.Counter.ProjectBoard),
+ )
+ ch <- prometheus.MustNewConstMetric(
c.PublicKeys,
prometheus.GaugeValue,
float64(stats.Counter.PublicKey),