Register metrics before main

This commit is contained in:
Hamcha 2019-05-27 14:50:47 +02:00
parent 7bb242e9e7
commit a0a24f37c0
Signed by: hamcha
GPG key ID: A40413D21021EAEE
2 changed files with 1 additions and 3 deletions

View file

@ -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()

View file

@ -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)