-
Notifications
You must be signed in to change notification settings - Fork 0
/
exporter.go
36 lines (30 loc) · 1.05 KB
/
exporter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"github.com/prometheus/client_golang/prometheus"
)
var (
prometheusStorageCount = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "restcaptcha_storage_count",
Help: "The total number of storage items",
})
prometheusShowTotal = prometheus.NewCounter(prometheus.CounterOpts{
Name: "restcaptcha_problem_request",
Help: "The total number of request for show the captcha",
})
prometheusValidTotal = prometheus.NewCounter(prometheus.CounterOpts{
Name: "restcaptcha_valid_request",
Help: "The total number of request for success validate",
})
prometheusInValidTotal = prometheus.NewCounter(prometheus.CounterOpts{
Name: "restcaptcha_invalid_request",
Help: "The total number of request for unsuccess validate",
})
)
func getPrometheusRegistry() *prometheus.Registry {
promRegistry := prometheus.NewRegistry()
promRegistry.MustRegister(prometheusStorageCount)
promRegistry.MustRegister(prometheusShowTotal)
promRegistry.MustRegister(prometheusValidTotal)
promRegistry.MustRegister(prometheusInValidTotal)
return promRegistry
}