Remove room_id from metrics, cardinality becomes too high and the prom scaper can't handle it

This commit is contained in:
Joakim Recht 2023-11-21 00:26:54 +01:00
parent 00c764812c
commit ab934b97cb
2 changed files with 5 additions and 7 deletions

View file

@ -276,8 +276,8 @@ func (w *worker) _next() {
if scope := sentry.CurrentHub().Scope(); scope != nil { if scope := sentry.CurrentHub().Scope(); scope != nil {
scope.SetTag("event_id", inputRoomEvent.Event.EventID()) scope.SetTag("event_id", inputRoomEvent.Event.EventID())
} }
roomserverInputBackpressure.With(prometheus.Labels{"room_id": w.roomID}).Inc() roomserverInputBackpressure.With(prometheus.Labels{}).Inc()
defer roomserverInputBackpressure.With(prometheus.Labels{"room_id": w.roomID}).Dec() defer roomserverInputBackpressure.With(prometheus.Labels{}).Dec()
// Process the room event. If something goes wrong then we'll tell // Process the room event. If something goes wrong then we'll tell
// NATS to terminate the message. We'll store the error result as // NATS to terminate the message. We'll store the error result as
@ -428,5 +428,5 @@ var roomserverInputBackpressure = prometheus.NewGaugeVec(
Name: "input_backpressure", Name: "input_backpressure",
Help: "How many events are queued for input for a given room", Help: "How many events are queued for input for a given room",
}, },
[]string{"room_id"}, []string{},
) )

View file

@ -62,7 +62,7 @@ var processRoomEventDuration = prometheus.NewHistogramVec(
7000, 8000, 9000, 10000, 15000, 20000, 7000, 8000, 9000, 10000, 15000, 20000,
}, },
}, },
[]string{"room_id"}, []string{},
) )
// processRoomEvent can only be called once at a time // processRoomEvent can only be called once at a time
@ -95,9 +95,7 @@ func (r *Inputer) processRoomEvent(
started := time.Now() started := time.Now()
defer func() { defer func() {
timetaken := time.Since(started) timetaken := time.Since(started)
processRoomEventDuration.With(prometheus.Labels{ processRoomEventDuration.With(prometheus.Labels{}).Observe(float64(timetaken.Milliseconds()))
"room_id": input.Event.RoomID().String(),
}).Observe(float64(timetaken.Milliseconds()))
}() }()
// Parse and validate the event JSON // Parse and validate the event JSON