Fix incorrect unsubscribed track telemetry (#1350)

- only log unsubscribe on close if Track was actually bound
- update subscribed counters even if a failure had been logged before
This commit is contained in:
David Zhao
2023-01-30 10:16:21 -08:00
committed by GitHub
parent 2671493870
commit b023c531c2
5 changed files with 42 additions and 23 deletions
+5
View File
@@ -260,10 +260,15 @@ func (t *telemetryService) TrackSubscribed(
participantID livekit.ParticipantID,
track *livekit.TrackInfo,
publisher *livekit.ParticipantInfo,
shouldSendEvent bool,
) {
t.enqueue(func() {
prometheus.RecordTrackSubscribeSuccess(track.Type.String())
if !shouldSendEvent {
return
}
room := t.getRoomDetails(participantID)
ev := newTrackEvent(livekit.AnalyticsEventType_TRACK_SUBSCRIBED, room, participantID, track)
ev.Publisher = publisher