Prometheus counter for Signal/RTC messages (#139)

This commit is contained in:
Mathew Kamkar
2021-10-08 12:02:08 -07:00
committed by GitHub
parent 2c9ef2f6bb
commit b212fb9a9e
5 changed files with 27 additions and 8 deletions
+6
View File
@@ -344,22 +344,28 @@ func (r *RedisRouter) redisWorker(startedChan chan struct{}) {
sm := livekit.SignalNodeMessage{}
if err := proto.Unmarshal([]byte(msg.Payload), &sm); err != nil {
logger.Errorw("could not unmarshal signal message on sigchan", err)
stats.PromMessageCounter.WithLabelValues("signal", "failure").Add(1)
continue
}
if err := r.handleSignalMessage(&sm); err != nil {
logger.Errorw("error processing signal message", err)
stats.PromMessageCounter.WithLabelValues("signal", "failure").Add(1)
continue
}
stats.PromMessageCounter.WithLabelValues("signal", "success").Add(1)
} else if msg.Channel == rtcChannel {
rm := livekit.RTCNodeMessage{}
if err := proto.Unmarshal([]byte(msg.Payload), &rm); err != nil {
logger.Errorw("could not unmarshal RTC message on rtcchan", err)
stats.PromMessageCounter.WithLabelValues("rtc", "failure").Add(1)
continue
}
if err := r.handleRTCMessage(&rm); err != nil {
logger.Errorw("error processing RTC message", err)
stats.PromMessageCounter.WithLabelValues("rtc", "failure").Add(1)
continue
}
stats.PromMessageCounter.WithLabelValues("rtc", "success").Add(1)
}
}
}