Send participant_connection_aborted when participant session is closed (#3848)

* Send `participant_connection_aborted` when participant session is closed
without becoming `ACTIVE`.

There is one sticky case. If there is a migration and the migration
fails, this will send `participant_connection_aborted` even though the
participant may have connected properly on the previous node.

* depsg
This commit is contained in:
Raja Subramanian
2025-08-13 10:36:31 +05:30
committed by GitHub
parent 61e59346ef
commit eed27885e5
3 changed files with 25 additions and 19 deletions
+10 -4
View File
@@ -112,7 +112,7 @@ func (t *telemetryService) ParticipantActive(
) {
t.enqueue(func() {
if !isMigration {
// consider participant joined only when they became active
// a participant is considered "joined" only when they become "active"
t.NotifyEvent(ctx, &livekit.WebhookEvent{
Event: webhook.EventParticipantJoined,
Room: room,
@@ -190,14 +190,20 @@ func (t *telemetryService) ParticipantLeft(ctx context.Context,
}
}
if isConnected && shouldSendEvent {
if shouldSendEvent {
webhookEvent := webhook.EventParticipantLeft
analyticsEvent := livekit.AnalyticsEventType_PARTICIPANT_LEFT
if !isConnected {
webhookEvent = webhook.EventParticipantConnectionAborted
analyticsEvent = livekit.AnalyticsEventType_PARTICIPANT_CONNECTION_ABORTED
}
t.NotifyEvent(ctx, &livekit.WebhookEvent{
Event: webhook.EventParticipantLeft,
Event: webhookEvent,
Room: room,
Participant: participant,
})
t.SendEvent(ctx, newParticipantEvent(livekit.AnalyticsEventType_PARTICIPANT_LEFT, room, participant))
t.SendEvent(ctx, newParticipantEvent(analyticsEvent, room, participant))
}
})
}