* 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
* send min/median connection score along with avg
* guard against divide by zero for avg score calculation
* update median calculation
Signed-off-by: shishir gowda <shishir@livekit.io>
* Use a go routine to clean up stats workers.
It is possible that certain events (like TrackUnpublished) can
happen after the participant is closed. For webhooks pertaining
to those events, need details like room name/id. So,reap stats
workers a little while after the participant left event happens.
* handle data race report
* log analytics worker reap
* debug log
* Use delta stats throughout and avoid calculating deltas in telemetry
* Fix a few things after testing
* Remove debug
* Fix tests
* delete instead of setting to nil
* Point to the latest protocol
* Telemetry and webhook improvements.
* avoid blocking on telemetry channel - increase channel size and drop when full
* send ParticipantJoined webhook when fully joined (i.e. on ParticipantActive)
* send TrackPublished & TrackUnpublished webhooks
* increase number of parallel webhook workers to 50
* update protocol
total_bytes is aggregate, when we switch from higher layer to lower
layer, it takes time for lower layers total_bytes to catch up to
stopped higher layers
Signed-off-by: shishir gowda <shishir@livekit.io>
* Compute delta stats to send downstream
Signed-off-by: shishir gowda <shishir@livekit.io>
* Update tests: total_packets should be diff between 2 packets
First packet was 1, second was 4. diff should be 3
Signed-off-by: shishir gowda <shishir@livekit.io>
* If there are no videoLayers, do not sent in Stats
For audio and Downstream tracks, we do not get layers
Signed-off-by: shishir gowda <shishir@livekit.io>
* Use prev Max layer for current delta and update layer info for next round
* WIP commit
* update protocol
* Fixing a test and catching one place where casting was missed
* Fix one more spot which need conversion from livekit.RoomName -> string
* do not covert list
It allows all actions/events to run in the same go routine.
Therefore no synchronization primitives are needed inside
telemetry service implementation.
* Make TelemetryService testable
Timer is extracted for better testability of telemetryservice.
Divided TelemetryService to internal part that:
- contains business logic
- does not contain timer
- and therefore testable
and external part that:
- does not contain business logic
- contains timer to send analytics every 10 seconds for all participants.
- does not need tests
* Add Test_AnalyticsSentWhenParticipantLeaves
* Fix test