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.
This commit is contained in:
Raja Subramanian
2026-02-03 07:07:24 +05:30
committed by GitHub
parent 1e689e1a24
commit d1bab17b76
+7
View File
@@ -1365,11 +1365,18 @@ func (p *ParticipantImpl) Close(sendLeave bool, reason types.ParticipantCloseRea
return nil return nil
} }
var sessionDuration time.Duration
if activeAt := p.ActiveAt(); !activeAt.IsZero() {
sessionDuration = time.Since(activeAt)
}
p.params.Logger.Infow( p.params.Logger.Infow(
"participant closing", "participant closing",
"sendLeave", sendLeave, "sendLeave", sendLeave,
"reason", reason.String(), "reason", reason.String(),
"isExpectedToResume", isExpectedToResume, "isExpectedToResume", isExpectedToResume,
"clientInfo", logger.Proto(sutils.ClientInfoWithoutAddress(p.GetClientInfo())),
"kind", p.Kind(),
"sessionDuration", sessionDuration,
) )
p.closeReason.Store(reason) p.closeReason.Store(reason)
p.clearDisconnectTimer() p.clearDisconnectTimer()