Use a worker to report signal/data stats. (#2260)

* Use a worker to report signal/data stats.

Was checking if reporting is needed on every update.
The check is wasted work if volume of signal/data messages is high
as reporting happens only once in 10 seconds.

Changing to a worker based on a timer. And also aligning with
telemetry reporting interval which defaults to 30 seconds.

* Remove unused constant
This commit is contained in:
Raja Subramanian
2023-11-22 11:47:15 +05:30
committed by GitHub
parent f18d6356e8
commit 56dd399684
4 changed files with 28 additions and 32 deletions
+2 -2
View File
@@ -126,8 +126,6 @@ func (s *StatsWorker) ClosedAt() time.Time {
return s.closedAt
}
// -------------------------------------------------------------------------
func (s *StatsWorker) collectStats(
ts *timestamppb.Timestamp,
streamType livekit.StreamType,
@@ -151,6 +149,8 @@ func (s *StatsWorker) collectStats(
return stats
}
// -------------------------------------------------------------------------
// create a single stream and single video layer post aggregation
func coalesce(stats []*livekit.AnalyticsStat) *livekit.AnalyticsStat {
if len(stats) == 0 {