From a0a24f37c0328abb92ad577231b2cf5d8b20a1b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AEittaG=20ordnasselA?= Date: Mon, 27 May 2019 14:50:47 +0200 Subject: [PATCH] Register metrics before main --- stats/main.go | 2 -- stats/metrics.go | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/stats/main.go b/stats/main.go index 095a402..40c2400 100644 --- a/stats/main.go +++ b/stats/main.go @@ -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() diff --git a/stats/metrics.go b/stats/metrics.go index 4554517..99219ff 100644 --- a/stats/metrics.go +++ b/stats/metrics.go @@ -26,7 +26,7 @@ var ( }) ) -func registerMetrics() { +func init() { prometheus.MustRegister(opTotalMsg) prometheus.MustRegister(opMsgPerChat) prometheus.MustRegister(opCommand)