...
1 package cushion
2
3 import "github.com/prometheus/client_golang/prometheus"
4
5 type Metrics struct {
6 CushionSuccessfulAcksTotal *prometheus.CounterVec
7 CushionFailedAcksTotal *prometheus.CounterVec
8 }
9
10 func NewMetrics() *Metrics {
11 m := &Metrics{
12 CushionSuccessfulAcksTotal: prometheus.NewCounterVec(
13 prometheus.CounterOpts{
14 Name: "cushion_successful_acks_total",
15 Help: "total number of successful cushion acks",
16 }, []string{"tenant_id", "db_name"}),
17 CushionFailedAcksTotal: prometheus.NewCounterVec(
18 prometheus.CounterOpts{
19 Name: "cushion_failed_acks_total",
20 Help: "total number of failed cushion acks",
21 }, []string{"tenant_id", "db_name"}),
22 }
23
24 prometheus.MustRegister(
25 m.CushionSuccessfulAcksTotal,
26 m.CushionFailedAcksTotal,
27 )
28
29 return m
30 }
31
32 func (m *Metrics) Reset() {
33 m.CushionFailedAcksTotal.Reset()
34 m.CushionSuccessfulAcksTotal.Reset()
35 }
36
View as plain text