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:
@@ -1434,13 +1434,13 @@ func (p *ParticipantImpl) IsMigration() bool {
|
|||||||
|
|
||||||
func (p *ParticipantImpl) recordRTCState(closeReason types.ParticipantCloseReason) {
|
func (p *ParticipantImpl) recordRTCState(closeReason types.ParticipantCloseReason) {
|
||||||
if p.HasConnected() {
|
if p.HasConnected() {
|
||||||
prometheus.IncrementParticipantRtcSuccess(1)
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.IsConnectionCanceled(closeReason) {
|
||||||
|
prometheus.IncrementParticipantRtcCanceled(1)
|
||||||
} else {
|
} else {
|
||||||
if p.IsConnectionCanceled(closeReason) {
|
prometheus.IncrementParticipantRtcFailure(1)
|
||||||
prometheus.IncrementParticipantRtcCanceled(1)
|
|
||||||
} else {
|
|
||||||
prometheus.IncrementParticipantRtcFailure(1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2648,6 +2648,7 @@ func (p *ParticipantImpl) onPrimaryTransportInitialConnected() {
|
|||||||
|
|
||||||
if !p.sessionStartRecorded.Swap(true) {
|
if !p.sessionStartRecorded.Swap(true) {
|
||||||
prometheus.RecordSessionStartTime(int(p.ProtocolVersion()), time.Since(p.params.SessionStartTime))
|
prometheus.RecordSessionStartTime(int(p.ProtocolVersion()), time.Since(p.params.SessionStartTime))
|
||||||
|
prometheus.IncrementParticipantRtcSuccess(1)
|
||||||
}
|
}
|
||||||
p.updateState(livekit.ParticipantInfo_ACTIVE)
|
p.updateState(livekit.ParticipantInfo_ACTIVE)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user