aboutsummaryrefslogtreecommitdiff
path: root/roomserver/internal
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2022-04-08 12:24:40 +0200
committerGitHub <noreply@github.com>2022-04-08 12:24:40 +0200
commite8dd37d533275233b7bebeeb70b996e166cf2d3b (patch)
tree5316a53ae7dc2931b4e74e9cc64d9702cd9d4a79 /roomserver/internal
parent25d99c44733036a638eb2e5061e42e90dd089f0e (diff)
Add metrics for internal API requests (#2310)
* Add response size and requests total to internal handler * Move MustRegister calls to New* funcs * Move MustRegister back to init * Init at some place, minimize changes
Diffstat (limited to 'roomserver/internal')
-rw-r--r--roomserver/internal/input/input.go5
-rw-r--r--roomserver/internal/input/input_events.go4
2 files changed, 1 insertions, 8 deletions
diff --git a/roomserver/internal/input/input.go b/roomserver/internal/input/input.go
index 6a8ae6d0..1fea6ef0 100644
--- a/roomserver/internal/input/input.go
+++ b/roomserver/internal/input/input.go
@@ -167,6 +167,7 @@ func (r *Inputer) startWorkerForRoom(roomID string) {
// will look to see if we have a worker for that room which has its
// own consumer. If we don't, we'll start one.
func (r *Inputer) Start() error {
+ prometheus.MustRegister(roomserverInputBackpressure, processRoomEventDuration)
_, err := r.JetStream.Subscribe(
"", // This is blank because we specified it in BindStream.
func(m *nats.Msg) {
@@ -421,10 +422,6 @@ func (r *Inputer) WriteOutputEvents(roomID string, updates []api.OutputEvent) er
return nil
}
-func init() {
- prometheus.MustRegister(roomserverInputBackpressure)
-}
-
var roomserverInputBackpressure = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "dendrite",
diff --git a/roomserver/internal/input/input_events.go b/roomserver/internal/input/input_events.go
index 1acbf044..3ab9ba4f 100644
--- a/roomserver/internal/input/input_events.go
+++ b/roomserver/internal/input/input_events.go
@@ -37,10 +37,6 @@ import (
"github.com/sirupsen/logrus"
)
-func init() {
- prometheus.MustRegister(processRoomEventDuration)
-}
-
// TODO: Does this value make sense?
const MaximumMissingProcessingTime = time.Minute * 2