-
Notifications
You must be signed in to change notification settings - Fork 487
/
metrics.go
44 lines (36 loc) · 1.2 KB
/
metrics.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
37
38
39
40
41
42
43
44
package vault
import "github.com/prometheus/client_golang/prometheus"
type metrics struct {
authTotal prometheus.Counter
secretReadTotal prometheus.Counter
authLeaseRenewalTotal prometheus.Counter
secretLeaseRenewalTotal prometheus.Counter
}
func newMetrics(r prometheus.Registerer) *metrics {
var m metrics
m.authTotal = prometheus.NewCounter(prometheus.CounterOpts{
Name: "remote_vault_auth_total",
Help: "Total number of times this component authenticated to Vault",
})
m.secretReadTotal = prometheus.NewCounter(prometheus.CounterOpts{
Name: "remote_vault_secret_reads_total",
Help: "Total number of times the secret was read from Vault",
})
m.authLeaseRenewalTotal = prometheus.NewCounter(prometheus.CounterOpts{
Name: "remote_vault_auth_lease_renewal_total",
Help: "Total number of times this component renewed its auth token lease",
})
m.secretLeaseRenewalTotal = prometheus.NewCounter(prometheus.CounterOpts{
Name: "remote_vault_secret_lease_renewal_total",
Help: "Total number of times this component renewed its secret lease",
})
if r != nil {
r.MustRegister(
m.authTotal,
m.secretReadTotal,
m.authLeaseRenewalTotal,
m.secretLeaseRenewalTotal,
)
}
return &m
}