forked from brocaar/chirpstack-network-server
/
metrics.go
34 lines (27 loc) · 967 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
27
28
29
30
31
32
33
34
package azureiothub
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
ec = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "backend_azure_iot_hub_event_count",
Help: "The number of received events by the Azure IoT Hub backend (per event type).",
}, []string{"event"})
cc = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "backend_azure_iot_hub_command_count",
Help: "The number of published commands by the Azure IoT Hub backend (per command type).",
}, []string{"command"})
cr = promauto.NewCounter(prometheus.CounterOpts{
Name: "backend_azure_connection_recover_count",
})
)
func azureEventCounter(e string) prometheus.Counter {
return ec.With(prometheus.Labels{"event": e})
}
func azureCommandCounter(c string) prometheus.Counter {
return cc.With(prometheus.Labels{"command": c})
}
func azureConnectionRecoverCounter() prometheus.Counter {
return cr
}