Register metrics before main
This commit is contained in:
parent
7bb242e9e7
commit
a0a24f37c0
2 changed files with 1 additions and 3 deletions
|
@ -36,8 +36,6 @@ func main() {
|
||||||
brokerAddr := flag.String("broker", "localhost:7314", "Broker address:port")
|
brokerAddr := flag.String("broker", "localhost:7314", "Broker address:port")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
registerMetrics()
|
|
||||||
|
|
||||||
broker, err := tg.ConnectToBroker(*brokerAddr)
|
broker, err := tg.ConnectToBroker(*brokerAddr)
|
||||||
assert(err)
|
assert(err)
|
||||||
defer broker.Close()
|
defer broker.Close()
|
||||||
|
|
|
@ -26,7 +26,7 @@ var (
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
func registerMetrics() {
|
func init() {
|
||||||
prometheus.MustRegister(opTotalMsg)
|
prometheus.MustRegister(opTotalMsg)
|
||||||
prometheus.MustRegister(opMsgPerChat)
|
prometheus.MustRegister(opMsgPerChat)
|
||||||
prometheus.MustRegister(opCommand)
|
prometheus.MustRegister(opCommand)
|
||||||
|
|
Reference in a new issue