Add reconnect reason and signal rtt calculation (#1381)

* Add connect reason and signal rtt calculate

* Update protocol

* solve comment
This commit is contained in:
cnderrauber
2023-02-06 11:12:25 +08:00
committed by GitHub
parent d67cdb6141
commit 8b6dab780c
16 changed files with 221 additions and 118 deletions
+3 -1
View File
@@ -130,11 +130,13 @@ func (t *telemetryService) ParticipantResumed(
room *livekit.Room,
participant *livekit.ParticipantInfo,
nodeID livekit.NodeID,
reason livekit.ReconnectReason,
) {
t.enqueue(func() {
ev := newParticipantEvent(livekit.AnalyticsEventType_PARTICIPANT_RESUMED, room, participant)
ev.ClientMeta = &livekit.AnalyticsClientMeta{
Node: string(nodeID),
Node: string(nodeID),
ReconnectReason: reason,
}
t.SendEvent(ctx, ev)
})
@@ -58,13 +58,14 @@ type FakeTelemetryService struct {
arg3 *livekit.ParticipantInfo
arg4 bool
}
ParticipantResumedStub func(context.Context, *livekit.Room, *livekit.ParticipantInfo, livekit.NodeID)
ParticipantResumedStub func(context.Context, *livekit.Room, *livekit.ParticipantInfo, livekit.NodeID, livekit.ReconnectReason)
participantResumedMutex sync.RWMutex
participantResumedArgsForCall []struct {
arg1 context.Context
arg2 *livekit.Room
arg3 *livekit.ParticipantInfo
arg4 livekit.NodeID
arg5 livekit.ReconnectReason
}
RoomEndedStub func(context.Context, *livekit.Room)
roomEndedMutex sync.RWMutex
@@ -419,19 +420,20 @@ func (fake *FakeTelemetryService) ParticipantLeftArgsForCall(i int) (context.Con
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}
func (fake *FakeTelemetryService) ParticipantResumed(arg1 context.Context, arg2 *livekit.Room, arg3 *livekit.ParticipantInfo, arg4 livekit.NodeID) {
func (fake *FakeTelemetryService) ParticipantResumed(arg1 context.Context, arg2 *livekit.Room, arg3 *livekit.ParticipantInfo, arg4 livekit.NodeID, arg5 livekit.ReconnectReason) {
fake.participantResumedMutex.Lock()
fake.participantResumedArgsForCall = append(fake.participantResumedArgsForCall, struct {
arg1 context.Context
arg2 *livekit.Room
arg3 *livekit.ParticipantInfo
arg4 livekit.NodeID
}{arg1, arg2, arg3, arg4})
arg5 livekit.ReconnectReason
}{arg1, arg2, arg3, arg4, arg5})
stub := fake.ParticipantResumedStub
fake.recordInvocation("ParticipantResumed", []interface{}{arg1, arg2, arg3, arg4})
fake.recordInvocation("ParticipantResumed", []interface{}{arg1, arg2, arg3, arg4, arg5})
fake.participantResumedMutex.Unlock()
if stub != nil {
fake.ParticipantResumedStub(arg1, arg2, arg3, arg4)
fake.ParticipantResumedStub(arg1, arg2, arg3, arg4, arg5)
}
}
@@ -441,17 +443,17 @@ func (fake *FakeTelemetryService) ParticipantResumedCallCount() int {
return len(fake.participantResumedArgsForCall)
}
func (fake *FakeTelemetryService) ParticipantResumedCalls(stub func(context.Context, *livekit.Room, *livekit.ParticipantInfo, livekit.NodeID)) {
func (fake *FakeTelemetryService) ParticipantResumedCalls(stub func(context.Context, *livekit.Room, *livekit.ParticipantInfo, livekit.NodeID, livekit.ReconnectReason)) {
fake.participantResumedMutex.Lock()
defer fake.participantResumedMutex.Unlock()
fake.ParticipantResumedStub = stub
}
func (fake *FakeTelemetryService) ParticipantResumedArgsForCall(i int) (context.Context, *livekit.Room, *livekit.ParticipantInfo, livekit.NodeID) {
func (fake *FakeTelemetryService) ParticipantResumedArgsForCall(i int) (context.Context, *livekit.Room, *livekit.ParticipantInfo, livekit.NodeID, livekit.ReconnectReason) {
fake.participantResumedMutex.RLock()
defer fake.participantResumedMutex.RUnlock()
argsForCall := fake.participantResumedArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5
}
func (fake *FakeTelemetryService) RoomEnded(arg1 context.Context, arg2 *livekit.Room) {
+1 -1
View File
@@ -26,7 +26,7 @@ type TelemetryService interface {
// ParticipantActive - a participant establishes media connection
ParticipantActive(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, clientMeta *livekit.AnalyticsClientMeta)
// ParticipantResumed - there has been an ICE restart or connection resume attempt
ParticipantResumed(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, nodeID livekit.NodeID)
ParticipantResumed(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, nodeID livekit.NodeID, reason livekit.ReconnectReason)
// ParticipantLeft - the participant leaves the room, only sent if ParticipantActive has been called before
ParticipantLeft(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo, shouldSendEvent bool)
// TrackPublishRequested - a publication attempt has been received