diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2022-04-08 12:24:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 12:24:40 +0200 |
commit | e8dd37d533275233b7bebeeb70b996e166cf2d3b (patch) | |
tree | 5316a53ae7dc2931b4e74e9cc64d9702cd9d4a79 /syncapi/sync | |
parent | 25d99c44733036a638eb2e5061e42e90dd089f0e (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 'syncapi/sync')
-rw-r--r-- | syncapi/sync/requestpool.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/syncapi/sync/requestpool.go b/syncapi/sync/requestpool.go index 6fc08bd9..70334099 100644 --- a/syncapi/sync/requestpool.go +++ b/syncapi/sync/requestpool.go @@ -67,6 +67,9 @@ func NewRequestPool( streams *streams.Streams, notifier *notifier.Notifier, producer PresencePublisher, ) *RequestPool { + prometheus.MustRegister( + activeSyncRequests, waitingSyncRequests, + ) rp := &RequestPool{ db: db, cfg: cfg, @@ -183,12 +186,6 @@ func (rp *RequestPool) updateLastSeen(req *http.Request, device *userapi.Device) rp.lastseen.Store(device.UserID+device.ID, time.Now()) } -func init() { - prometheus.MustRegister( - activeSyncRequests, waitingSyncRequests, - ) -} - var activeSyncRequests = prometheus.NewGauge( prometheus.GaugeOpts{ Namespace: "dendrite", |