-
Notifications
You must be signed in to change notification settings - Fork 24
/
metrics.go
38 lines (31 loc) · 1.17 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
package cqrs
import "github.com/prometheus/client_golang/prometheus"
var (
metricsCommandsDispatched *prometheus.CounterVec
metricsCommandsFailed *prometheus.CounterVec
metricsEventsDispatched *prometheus.CounterVec
metricsEventsFailed *prometheus.CounterVec
)
func init() {
metricsCommandsDispatched = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "cqrs_commands_dispatched",
Subsystem: "ix",
Help: "CQRS Commands Dispatched",
}, []string{"command"})
metricsCommandsFailed = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "cqrs_commands_failed",
Subsystem: "ix",
Help: "CQRS Commands Failed",
}, []string{"command"})
metricsEventsDispatched = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "cqrs_events_dispatched",
Subsystem: "ix",
Help: "CQRS Events Dispatched",
}, []string{"event"})
metricsEventsFailed = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "cqrs_events_failed",
Subsystem: "ix",
Help: "CQRS Events Failed",
}, []string{"event"})
prometheus.MustRegister(metricsCommandsDispatched, metricsCommandsFailed, metricsEventsDispatched, metricsEventsFailed)
}