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")
flag.Parse()
registerMetrics()
broker, err := tg.ConnectToBroker(*brokerAddr)
assert(err)
defer broker.Close()

View file

@ -26,7 +26,7 @@ var (
})
)
func registerMetrics() {
func init() {
prometheus.MustRegister(opTotalMsg)
prometheus.MustRegister(opMsgPerChat)
prometheus.MustRegister(opCommand)