Webhook analytics event. (#3423)

* Webhook analytics event.

* deps

* generate

* nil notifier
This commit is contained in:
Raja Subramanian
2025-02-13 10:39:45 +05:30
committed by GitHub
parent 7fef374b19
commit 1ae2e48c2e
6 changed files with 91 additions and 34 deletions
+7 -2
View File
@@ -79,6 +79,7 @@ type TelemetryService interface {
LocalRoomState(ctx context.Context, info *livekit.AnalyticsNodeRooms)
Report(ctx context.Context, reportInfo *livekit.ReportInfo)
APICall(ctx context.Context, apiCallInfo *livekit.APICallInfo)
Webhook(ctx context.Context, webhookInfo *livekit.WebhookInfo)
// helpers
AnalyticsService
@@ -110,8 +111,7 @@ type telemetryService struct {
func NewTelemetryService(notifier webhook.QueuedNotifier, analytics AnalyticsService) TelemetryService {
t := &telemetryService{
AnalyticsService: analytics,
notifier: notifier,
notifier: notifier,
jobsQueue: utils.NewOpsQueue(utils.OpsQueueParams{
Name: "telemetry",
MinSize: jobsQueueMinSize,
@@ -120,6 +120,11 @@ func NewTelemetryService(notifier webhook.QueuedNotifier, analytics AnalyticsSer
}),
workers: make(map[livekit.ParticipantID]*StatsWorker),
}
if t.notifier != nil {
t.notifier.RegisterProcessedHook(func(ctx context.Context, whi *livekit.WebhookInfo) {
t.Webhook(ctx, whi)
})
}
t.jobsQueue.Start()
go t.run()