forked from brocaar/chirpstack-network-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.go
26 lines (21 loc) · 776 Bytes
/
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
package gcppubsub
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
ec = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "backend_gcp_pub_sub_event_count",
Help: "The number of received events by the GCP Pub/Sub backend (per event type).",
}, []string{"event"})
cc = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "backend_gcp_pub_sub_command_count",
Help: "The number of published commands by the GCP Pub/Sub backend (per command type).",
}, []string{"command"})
)
func gcpEventCounter(e string) prometheus.Counter {
return ec.With(prometheus.Labels{"event": e})
}
func gcpCommandCounter(c string) prometheus.Counter {
return cc.With(prometheus.Labels{"command": c})
}