aboutsummaryrefslogtreecommitdiff
path: root/clientapi
diff options
context:
space:
mode:
Diffstat (limited to 'clientapi')
-rw-r--r--clientapi/routing/register.go5
-rw-r--r--clientapi/routing/routing.go3
-rw-r--r--clientapi/routing/sendevent.go4
3 files changed, 3 insertions, 9 deletions
diff --git a/clientapi/routing/register.go b/clientapi/routing/register.go
index 7d84f249..8253f315 100644
--- a/clientapi/routing/register.go
+++ b/clientapi/routing/register.go
@@ -64,11 +64,6 @@ const (
sessionIDLength = 24
)
-func init() {
- // Register prometheus metrics. They must be registered to be exposed.
- prometheus.MustRegister(amtRegUsers)
-}
-
// sessionsDict keeps track of completed auth stages for each session.
// It shouldn't be passed by value because it contains a mutex.
type sessionsDict struct {
diff --git a/clientapi/routing/routing.go b/clientapi/routing/routing.go
index 32e83187..37d825b8 100644
--- a/clientapi/routing/routing.go
+++ b/clientapi/routing/routing.go
@@ -37,6 +37,7 @@ import (
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util"
"github.com/nats-io/nats.go"
+ "github.com/prometheus/client_golang/prometheus"
"github.com/sirupsen/logrus"
)
@@ -60,6 +61,8 @@ func Setup(
extRoomsProvider api.ExtraPublicRoomsProvider,
mscCfg *config.MSCs, natsClient *nats.Conn,
) {
+ prometheus.MustRegister(amtRegUsers, sendEventDuration)
+
rateLimits := httputil.NewRateLimits(&cfg.RateLimiting)
userInteractiveAuth := auth.NewUserInteractive(userAPI, cfg)
diff --git a/clientapi/routing/sendevent.go b/clientapi/routing/sendevent.go
index c5884e80..1211fa72 100644
--- a/clientapi/routing/sendevent.go
+++ b/clientapi/routing/sendevent.go
@@ -46,10 +46,6 @@ var (
userRoomSendMutexes sync.Map // (roomID+userID) -> mutex. mutexes to ensure correct ordering of sendEvents
)
-func init() {
- prometheus.MustRegister(sendEventDuration)
-}
-
var sendEventDuration = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: "dendrite",