* egress updates

* pass egressInfo to delete

* update typefakes

* export StartEgress

* update protocol

* new rpc, rename stores

* add json tag

* update tests

* update protocol
This commit is contained in:
David Colburn
2022-02-24 14:57:14 -08:00
committed by GitHub
parent b7aac6cb6b
commit 20f21cce2b
28 changed files with 1952 additions and 507 deletions
@@ -10,6 +10,18 @@ import (
)
type FakeTelemetryService struct {
EgressEndedStub func(context.Context, *livekit.EgressInfo)
egressEndedMutex sync.RWMutex
egressEndedArgsForCall []struct {
arg1 context.Context
arg2 *livekit.EgressInfo
}
EgressStartedStub func(context.Context, *livekit.EgressInfo)
egressStartedMutex sync.RWMutex
egressStartedArgsForCall []struct {
arg1 context.Context
arg2 *livekit.EgressInfo
}
ParticipantActiveStub func(context.Context, livekit.ParticipantID, *livekit.AnalyticsClientMeta)
participantActiveMutex sync.RWMutex
participantActiveArgsForCall []struct {
@@ -113,6 +125,72 @@ type FakeTelemetryService struct {
invocationsMutex sync.RWMutex
}
func (fake *FakeTelemetryService) EgressEnded(arg1 context.Context, arg2 *livekit.EgressInfo) {
fake.egressEndedMutex.Lock()
fake.egressEndedArgsForCall = append(fake.egressEndedArgsForCall, struct {
arg1 context.Context
arg2 *livekit.EgressInfo
}{arg1, arg2})
stub := fake.EgressEndedStub
fake.recordInvocation("EgressEnded", []interface{}{arg1, arg2})
fake.egressEndedMutex.Unlock()
if stub != nil {
fake.EgressEndedStub(arg1, arg2)
}
}
func (fake *FakeTelemetryService) EgressEndedCallCount() int {
fake.egressEndedMutex.RLock()
defer fake.egressEndedMutex.RUnlock()
return len(fake.egressEndedArgsForCall)
}
func (fake *FakeTelemetryService) EgressEndedCalls(stub func(context.Context, *livekit.EgressInfo)) {
fake.egressEndedMutex.Lock()
defer fake.egressEndedMutex.Unlock()
fake.EgressEndedStub = stub
}
func (fake *FakeTelemetryService) EgressEndedArgsForCall(i int) (context.Context, *livekit.EgressInfo) {
fake.egressEndedMutex.RLock()
defer fake.egressEndedMutex.RUnlock()
argsForCall := fake.egressEndedArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeTelemetryService) EgressStarted(arg1 context.Context, arg2 *livekit.EgressInfo) {
fake.egressStartedMutex.Lock()
fake.egressStartedArgsForCall = append(fake.egressStartedArgsForCall, struct {
arg1 context.Context
arg2 *livekit.EgressInfo
}{arg1, arg2})
stub := fake.EgressStartedStub
fake.recordInvocation("EgressStarted", []interface{}{arg1, arg2})
fake.egressStartedMutex.Unlock()
if stub != nil {
fake.EgressStartedStub(arg1, arg2)
}
}
func (fake *FakeTelemetryService) EgressStartedCallCount() int {
fake.egressStartedMutex.RLock()
defer fake.egressStartedMutex.RUnlock()
return len(fake.egressStartedArgsForCall)
}
func (fake *FakeTelemetryService) EgressStartedCalls(stub func(context.Context, *livekit.EgressInfo)) {
fake.egressStartedMutex.Lock()
defer fake.egressStartedMutex.Unlock()
fake.EgressStartedStub = stub
}
func (fake *FakeTelemetryService) EgressStartedArgsForCall(i int) (context.Context, *livekit.EgressInfo) {
fake.egressStartedMutex.RLock()
defer fake.egressStartedMutex.RUnlock()
argsForCall := fake.egressStartedArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeTelemetryService) ParticipantActive(arg1 context.Context, arg2 livekit.ParticipantID, arg3 *livekit.AnalyticsClientMeta) {
fake.participantActiveMutex.Lock()
fake.participantActiveArgsForCall = append(fake.participantActiveArgsForCall, struct {
@@ -593,6 +671,10 @@ func (fake *FakeTelemetryService) TrackUnsubscribedArgsForCall(i int) (context.C
func (fake *FakeTelemetryService) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.egressEndedMutex.RLock()
defer fake.egressEndedMutex.RUnlock()
fake.egressStartedMutex.RLock()
defer fake.egressStartedMutex.RUnlock()
fake.participantActiveMutex.RLock()
defer fake.participantActiveMutex.RUnlock()
fake.participantJoinedMutex.RLock()
+14
View File
@@ -29,6 +29,8 @@ type TelemetryService interface {
RecordingStarted(ctx context.Context, ri *livekit.RecordingInfo)
RecordingEnded(ctx context.Context, ri *livekit.RecordingInfo)
ParticipantActive(ctx context.Context, participantID livekit.ParticipantID, clientMeta *livekit.AnalyticsClientMeta)
EgressStarted(ctx context.Context, info *livekit.EgressInfo)
EgressEnded(ctx context.Context, info *livekit.EgressInfo)
}
type doWorkFunc func()
@@ -150,3 +152,15 @@ func (t *telemetryService) TrackMaxSubscribedVideoQuality(ctx context.Context, p
t.internalService.TrackMaxSubscribedVideoQuality(ctx, participantID, track, maxQuality)
}
}
func (t *telemetryService) EgressStarted(ctx context.Context, info *livekit.EgressInfo) {
t.jobQueue <- func() {
t.internalService.EgressStarted(ctx, info)
}
}
func (t *telemetryService) EgressEnded(ctx context.Context, info *livekit.EgressInfo) {
t.jobQueue <- func() {
t.internalService.EgressEnded(ctx, info)
}
}
@@ -247,3 +247,31 @@ func (t *telemetryServiceInternal) ParticipantActive(ctx context.Context, partic
ClientMeta: clientMeta,
})
}
func (t *telemetryServiceInternal) EgressStarted(ctx context.Context, info *livekit.EgressInfo) {
t.notifyEvent(ctx, &livekit.WebhookEvent{
Event: webhook.EventEgressStarted,
EgressInfo: info,
})
t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{
Type: livekit.AnalyticsEventType_EGRESS_STARTED,
Timestamp: timestamppb.Now(),
EgressId: info.EgressId,
RoomId: info.RoomId,
})
}
func (t *telemetryServiceInternal) EgressEnded(ctx context.Context, info *livekit.EgressInfo) {
t.notifyEvent(ctx, &livekit.WebhookEvent{
Event: webhook.EventEgressEnded,
EgressInfo: info,
})
t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{
Type: livekit.AnalyticsEventType_EGRESS_ENDED,
Timestamp: timestamppb.Now(),
EgressId: info.EgressId,
RoomId: info.RoomId,
})
}