-
Notifications
You must be signed in to change notification settings - Fork 10
/
metrics.go
33 lines (26 loc) · 1.07 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
package messagebroker
import (
"os"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
env string
messageBrokerOperationCount *prometheus.CounterVec
messageBrokerOperationTimeTaken *prometheus.HistogramVec
messageBrokerOperationError *prometheus.CounterVec
)
func init() {
env = os.Getenv("APP_ENV")
messageBrokerOperationCount = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "metro_message_broker_operation_total_count",
}, []string{"env", "broker", "operation"})
messageBrokerOperationTimeTaken = promauto.NewHistogramVec(prometheus.HistogramOpts{
Name: "metro_message_broker_time_taken_for_operation_sec",
Help: "Time taken for each message broker operation",
Buckets: prometheus.ExponentialBuckets(0.001, 1.25, 100),
}, []string{"env", "broker", "operation"})
messageBrokerOperationError = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "metro_message_broker_operation_error_count",
}, []string{"env", "broker", "operation", "error"})
}