Record more RTC cancellation points. (#4600)
There are several places the participant can drop off after initiating a connection attempt. Count those places as cancellation including when participant is closed due to specific reasons. Cancels should be discounted when determining RTC/ICE connectivity success/failure percentage.
This commit is contained in:
@@ -1413,12 +1413,30 @@ func (p *ParticipantImpl) IsReconnect() bool {
|
||||
return p.params.Reconnect
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) maybeRecordRTCanceled(closeReason types.ParticipantCloseReason) {
|
||||
if p.State() >= livekit.ParticipantInfo_ACTIVE {
|
||||
return
|
||||
}
|
||||
|
||||
if closeReason == types.ParticipantCloseReasonClientRequestLeave ||
|
||||
closeReason == types.ParticipantCloseReasonDuplicateIdentity ||
|
||||
closeReason == types.ParticipantCloseReasonRoomClosed ||
|
||||
closeReason == types.ParticipantCloseReasonMigrationRequested ||
|
||||
closeReason == types.ParticipantCloseReasonMigrationComplete ||
|
||||
// client closing signal connection too quickly, there is a time check to handle clients timing out and leaving without sending a leave message
|
||||
(time.Since(p.params.SessionStartTime) < 3*time.Second && closeReason == types.ParticipantCloseReasonSignalSourceClose) {
|
||||
prometheus.IncrementParticipantRtcCanceled(1)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) Close(sendLeave bool, reason types.ParticipantCloseReason, isExpectedToResume bool) error {
|
||||
if p.isClosed.Swap(true) {
|
||||
// already closed
|
||||
return nil
|
||||
}
|
||||
|
||||
p.maybeRecordRTCanceled(reason)
|
||||
|
||||
var sessionDuration time.Duration
|
||||
if activeAt := p.ActiveAt(); !activeAt.IsZero() {
|
||||
sessionDuration = time.Since(activeAt)
|
||||
|
||||
Reference in New Issue
Block a user