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

View File

@@ -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()