From d1bab17b76f24797b47cc36f55f7bff0ea4d2f1c Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Tue, 3 Feb 2026 07:07:24 +0530 Subject: [PATCH] Add session duration and participant kind to closing log. (#4277) To allow using "participant closing" log entry for calculating things like session duration by paricipant kind or some other client SDK based attribute. --- pkg/rtc/participant.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index 72d9199a2..b572275c6 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -1365,11 +1365,18 @@ func (p *ParticipantImpl) Close(sendLeave bool, reason types.ParticipantCloseRea return nil } + var sessionDuration time.Duration + if activeAt := p.ActiveAt(); !activeAt.IsZero() { + sessionDuration = time.Since(activeAt) + } p.params.Logger.Infow( "participant closing", "sendLeave", sendLeave, "reason", reason.String(), "isExpectedToResume", isExpectedToResume, + "clientInfo", logger.Proto(sutils.ClientInfoWithoutAddress(p.GetClientInfo())), + "kind", p.Kind(), + "sessionDuration", sessionDuration, ) p.closeReason.Store(reason) p.clearDisconnectTimer()