egress updated webhook (#1555)

This commit is contained in:
David Colburn
2023-03-27 16:34:44 -07:00
committed by GitHub
parent 96607a170a
commit 108b251045
4 changed files with 60 additions and 17 deletions
+9
View File
@@ -411,6 +411,15 @@ func (t *telemetryService) EgressStarted(ctx context.Context, info *livekit.Egre
})
}
func (t *telemetryService) EgressUpdated(ctx context.Context, info *livekit.EgressInfo) {
t.enqueue(func() {
t.NotifyEvent(ctx, &livekit.WebhookEvent{
Event: webhook.EventEgressUpdated,
EgressInfo: info,
})
})
}
func (t *telemetryService) EgressEnded(ctx context.Context, info *livekit.EgressInfo) {
t.enqueue(func() {
t.NotifyEvent(ctx, &livekit.WebhookEvent{
@@ -22,6 +22,12 @@ type FakeTelemetryService struct {
arg1 context.Context
arg2 *livekit.EgressInfo
}
EgressUpdatedStub func(context.Context, *livekit.EgressInfo)
egressUpdatedMutex sync.RWMutex
egressUpdatedArgsForCall []struct {
arg1 context.Context
arg2 *livekit.EgressInfo
}
FlushStatsStub func()
flushStatsMutex sync.RWMutex
flushStatsArgsForCall []struct {
@@ -274,6 +280,39 @@ func (fake *FakeTelemetryService) EgressStartedArgsForCall(i int) (context.Conte
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeTelemetryService) EgressUpdated(arg1 context.Context, arg2 *livekit.EgressInfo) {
fake.egressUpdatedMutex.Lock()
fake.egressUpdatedArgsForCall = append(fake.egressUpdatedArgsForCall, struct {
arg1 context.Context
arg2 *livekit.EgressInfo
}{arg1, arg2})
stub := fake.EgressUpdatedStub
fake.recordInvocation("EgressUpdated", []interface{}{arg1, arg2})
fake.egressUpdatedMutex.Unlock()
if stub != nil {
fake.EgressUpdatedStub(arg1, arg2)
}
}
func (fake *FakeTelemetryService) EgressUpdatedCallCount() int {
fake.egressUpdatedMutex.RLock()
defer fake.egressUpdatedMutex.RUnlock()
return len(fake.egressUpdatedArgsForCall)
}
func (fake *FakeTelemetryService) EgressUpdatedCalls(stub func(context.Context, *livekit.EgressInfo)) {
fake.egressUpdatedMutex.Lock()
defer fake.egressUpdatedMutex.Unlock()
fake.EgressUpdatedStub = stub
}
func (fake *FakeTelemetryService) EgressUpdatedArgsForCall(i int) (context.Context, *livekit.EgressInfo) {
fake.egressUpdatedMutex.RLock()
defer fake.egressUpdatedMutex.RUnlock()
argsForCall := fake.egressUpdatedArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeTelemetryService) FlushStats() {
fake.flushStatsMutex.Lock()
fake.flushStatsArgsForCall = append(fake.flushStatsArgsForCall, struct {
@@ -1109,6 +1148,8 @@ func (fake *FakeTelemetryService) Invocations() map[string][][]interface{} {
defer fake.egressEndedMutex.RUnlock()
fake.egressStartedMutex.RLock()
defer fake.egressStartedMutex.RUnlock()
fake.egressUpdatedMutex.RLock()
defer fake.egressUpdatedMutex.RUnlock()
fake.flushStatsMutex.RLock()
defer fake.flushStatsMutex.RUnlock()
fake.notifyEventMutex.RLock()
+1
View File
@@ -54,6 +54,7 @@ type TelemetryService interface {
TrackPublishRTPStats(ctx context.Context, participantID livekit.ParticipantID, trackID livekit.TrackID, mimeType string, layer int, stats *livekit.RTPStats)
TrackSubscribeRTPStats(ctx context.Context, participantID livekit.ParticipantID, trackID livekit.TrackID, mimeType string, stats *livekit.RTPStats)
EgressStarted(ctx context.Context, info *livekit.EgressInfo)
EgressUpdated(ctx context.Context, info *livekit.EgressInfo)
EgressEnded(ctx context.Context, info *livekit.EgressInfo)
// helpers