Record rtc_success prom as soon as RTC connects. (#4677)

Was doing it on participant close. But, that misaligns `rtc_init`
(number of attempts) a bit if the participant sessions are long.
Record it as soon as RTC connects so that it is more time aligned with
`rtc_init`.
This commit is contained in:
Raja Subramanian
2026-07-16 12:49:27 +05:30
committed by GitHub
parent cce14a6fec
commit 38d7efca83
+7 -6
View File
@@ -1434,13 +1434,13 @@ func (p *ParticipantImpl) IsMigration() bool {
func (p *ParticipantImpl) recordRTCState(closeReason types.ParticipantCloseReason) {
if p.HasConnected() {
prometheus.IncrementParticipantRtcSuccess(1)
return
}
if p.IsConnectionCanceled(closeReason) {
prometheus.IncrementParticipantRtcCanceled(1)
} else {
if p.IsConnectionCanceled(closeReason) {
prometheus.IncrementParticipantRtcCanceled(1)
} else {
prometheus.IncrementParticipantRtcFailure(1)
}
prometheus.IncrementParticipantRtcFailure(1)
}
}
@@ -2648,6 +2648,7 @@ func (p *ParticipantImpl) onPrimaryTransportInitialConnected() {
if !p.sessionStartRecorded.Swap(true) {
prometheus.RecordSessionStartTime(int(p.ProtocolVersion()), time.Since(p.params.SessionStartTime))
prometheus.IncrementParticipantRtcSuccess(1)
}
p.updateState(livekit.ParticipantInfo_ACTIVE)
}