summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 17f8dd133f..94699c161c 100755
--- a/modules/metrics/collector.go
+++ b/modules/metrics/collector.go
@@ -4,7 +4,10 @@
package metrics
import (
+ "runtime"
+
activities_model "code.gitea.io/gitea/models/activities"
+ "code.gitea.io/gitea/modules/setting"
"github.com/prometheus/client_golang/prometheus"
)
@@ -17,6 +20,7 @@ type Collector struct {
Accesses *prometheus.Desc
Actions *prometheus.Desc
Attachments *prometheus.Desc
+ BuildInfo *prometheus.Desc
Comments *prometheus.Desc
Follows *prometheus.Desc
HookTasks *prometheus.Desc
@@ -62,6 +66,16 @@ func NewCollector() Collector {
"Number of Attachments",
nil, nil,
),
+ BuildInfo: prometheus.NewDesc(
+ namespace+"build_info",
+ "Build information",
+ []string{
+ "goarch",
+ "goos",
+ "goversion",
+ "version",
+ }, nil,
+ ),
Comments: prometheus.NewDesc(
namespace+"comments",
"Number of Comments",
@@ -195,6 +209,7 @@ func (c Collector) Describe(ch chan<- *prometheus.Desc) {
ch <- c.Accesses
ch <- c.Actions
ch <- c.Attachments
+ ch <- c.BuildInfo
ch <- c.Comments
ch <- c.Follows
ch <- c.HookTasks
@@ -242,6 +257,15 @@ func (c Collector) Collect(ch chan<- prometheus.Metric) {
float64(stats.Counter.Attachment),
)
ch <- prometheus.MustNewConstMetric(
+ c.BuildInfo,
+ prometheus.GaugeValue,
+ 1,
+ runtime.GOARCH,
+ runtime.GOOS,
+ runtime.Version(),
+ setting.AppVer,
+ )
+ ch <- prometheus.MustNewConstMetric(
c.Comments,
prometheus.GaugeValue,
float64(stats.Counter.Comment),