diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-02-03 00:08:19 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-02-07 21:38:47 +0300 |
commit | ddff37bc7cecf2f73a7bb82d60391505ad96a426 (patch) | |
tree | 88bdfc87ba74866da6224ddea200062fee31e5aa /metrics/metrics.go | |
parent | 1e31fac9d8a60efb3b2b536a46e059f286ab62c0 (diff) |
Improve complexity metrics
Also fixed the dependencies, moved metrics to its own package and
updated the tests
Diffstat (limited to 'metrics/metrics.go')
-rw-r--r-- | metrics/metrics.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/metrics/metrics.go b/metrics/metrics.go new file mode 100644 index 00000000..00e39460 --- /dev/null +++ b/metrics/metrics.go @@ -0,0 +1,42 @@ +package metrics + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +var ( + DomainsServed = prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "gitlab_pages_domains_served_total", + Help: "The total number of sites served by this Pages app", + }) + + DomainUpdates = prometheus.NewCounter(prometheus.CounterOpts{ + Name: "gitlab_pages_domains_updated_total", + Help: "The total number of site updates processed since daemon start", + }) + + DomainLastUpdateTime = prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "gitlab_pages_last_domain_update_seconds", + Help: "UNIX timestamp of the last update", + }) + + ProcessedRequests = prometheus.NewCounterVec(prometheus.CounterOpts{ + Name: "gitlab_pages_http_requests_total", + Help: "Total number of HTTP requests done serving", + }, + []string{"code", "method"}, + ) + + SessionsActive = prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "gitlab_pages_http_sessions_active", + Help: "The number of HTTP requests currently being processed", + }) +) + +func init() { + prometheus.MustRegister(DomainsServed) + prometheus.MustRegister(DomainUpdates) + prometheus.MustRegister(DomainLastUpdateTime) + prometheus.MustRegister(ProcessedRequests) + prometheus.MustRegister(SessionsActive) +} |