Commit Graph

37 Commits

Author SHA1 Message Date
Raja Subramanian
56dd399684 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
2023-11-22 11:47:15 +05:30
David Zhao
981fb7cac7 Adding license notices (#1913)
* Adding license notices

* remove from config
2023-07-27 16:43:19 -07:00
shishirng
3de51181ec Fix setting minscore - initialized to 0 (#1725)
Signed-off-by: shishir gowda <shishir@livekit.io>
2023-05-19 11:00:32 -04:00
shishirng
2e93d386fe send min/median connection score along with avg (#1720)
* 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>
2023-05-18 13:50:54 -04:00
David Zhao
5ff72a99b9 Report publish & subscribe RTPStats as Telemetry events (#1506) 2023-03-10 10:28:54 -08:00
David Zhao
33902a9f2a Do not send ParticipantLeft webhook event unless connected successfully. (#1234)
Fixes #1130
2022-12-18 17:37:55 -08:00
David Colburn
803046b882 Auto egress (#1011)
* auto egress

* fix room service test

* reuse StartTrackEgress

* add timestamp

* update prefixed filename explicitly

* update protocol

* clean up telemetry

* fix telemetry tests

* separate room internal storage

* auto participant egress

* remove custom template url

* fix internal key

* use map for stats workers

* remove sync.Map

* remove participant composite
2022-09-21 12:04:19 -07:00
Raja Subramanian
29039b4e76 Use a go routine to clean up stats workers. (#836)
* 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
2022-07-18 11:47:43 +05:30
Raja Subramanian
8ef53037eb Lock stats worker maps (#704) 2022-05-21 10:36:49 +05:30
Raja Subramanian
a98d955284 Delta stats throughout (#615)
* 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
2022-04-16 21:11:32 +05:30
David Colburn
0b8a180554 Code inspection (#581)
* Code inspection

* fix [4]int64 conversiong
2022-03-30 13:49:53 -07:00
shishirng
a6bb59b159 handle deltas being null leading to crash (#567)
Signed-off-by: shishir gowda <shishir@livekit.io>
2022-03-25 19:18:32 -04:00
shishirng
579d3d1a19 Check if current stats < prev and guard against underflow (#563)
Signed-off-by: shishir gowda <shishir@livekit.io>
2022-03-23 15:16:59 -04:00
David Zhao
f14c452f8c Telemetry and webhook improvements. (#535)
* 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
2022-03-18 23:20:33 -07:00
shishirng
c34b907d58 Add checks to prevent bytes/packet counts from going -ve (#499)
Signed-off-by: shishir gowda <shishir@livekit.io>
2022-03-09 16:51:23 -05:00
Raja Subramanian
0170cc1cb6 Staticcheck (#464)
Using `go get -u honnef.co/go/tools/cmd/staticcheck`
Uneaarthed a couple of real bugs
2022-02-25 12:04:08 +05:30
shishirng
7fcb887eb8 use delta bytes in window to identify max layer (#442)
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>
2022-02-17 15:15:10 -05:00
shishirng
c534099e3a fix connection_scores not being sent to telemetry during delta calc (#439)
Signed-off-by: shishir gowda <shishir@livekit.io>
2022-02-16 19:31:59 -05:00
shishirng
e96e8e7f97 Clean up closed tracks stats and handle -ve packet_lost (#430)
Signed-off-by: shishir gowda <shishir@livekit.io>
2022-02-10 11:21:17 -05:00
shishirng
6f7e6c4556 Compute delta stats to send downstream (#426)
* 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
2022-02-09 20:45:53 -05:00
Raja Subramanian
36289bbca7 FPS (#410)
* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* WIP commit

* Clean up

* Clean up

* Store RTT in stats

* spelling mistake

* Make tests compile

* Fix test compilation error

* fix tests

* clone

* latest protocol
2022-02-08 12:53:14 +05:30
shishirng
26eea78b54 Telemetry connection scores (#377)
* octets - total bytes needs to be uint64

uint32 wraps at 4GB

Signed-off-by: shishir gowda <shishir@livekit.io>

* Cleanup stats handler to use connectionQuality stats

remove per packet rtcp handlers, buffer stats

* cleanup connection stats

* Update mediatrack to store rtcp stats in connection stats

* Update downstream handling of connection stats and telemetry

* Update telemetry tests

Signed-off-by: shishir gowda <shishir@livekit.io>

* Misc fixes

Signed-off-by: shishir gowda <shishir@livekit.io>

* Minor fix to avoid accessing buffer before its allocated

Signed-off-by: shishir gowda <shishir@livekit.io>

* start updateStats worker in AddReciever()

Signed-off-by: shishir gowda <shishir@livekit.io>

* Use previous score to calculate avg scores

* Restructure connectionStats

Signed-off-by: shishir gowda <shishir@livekit.io>
2022-01-27 11:24:54 -05:00
David Colburn
5bea9debb7 Code cleanup (#353) 2022-01-19 02:13:06 -08:00
Raja Subramanian
995c1e8676 type aliases -> type definitions (#312)
* type alias -> type definition

* participantSid -> participantID in a comment

* Update protocol
2022-01-03 12:43:58 +05:30
Raja Subramanian
3a9009ae12 type definition of room name (#311)
* 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
2022-01-02 16:49:16 +05:30
Artur Shellunts
6f84b36ccf Use RTT field in analytics stats (#304)
* Update protocol to v0.11.7

* Use RTT field in analytics stats

Instead of Delay
2021-12-30 13:13:40 +01:00
Raja Subramanian
07db1ba726 Some more files with types (#302) 2021-12-30 16:43:20 +05:30
Artur Shellunts
1b66fe1e23 Fix handling of PacketLost (#296)
They come accumulated already.
2021-12-30 11:06:00 +01:00
Artur Shellunts
b744a9c2ba Implement event loop for telemetry service (#297)
It allows all actions/events to run in the same go routine.
Therefore no synchronization primitives are needed inside
telemetry service implementation.
2021-12-29 19:51:12 +01:00
Artur Shellunts
828d490755 Imlement analytics per track statistics (#281)
New tests for telemetry + implementation of per track statistics
2021-12-29 19:29:24 +01:00
Artur Shellunts
2209edce20 Make TelemetryService testable (#276)
* 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
2021-12-28 12:54:56 +01:00
David Colburn
faa870de3d Move callbacks out of messageRouter (#269)
* move callbacks out of messageRouter

* OCD

* more OCD

* fix forwarder test

* even more OCD

* maximum OCD

* package name collision, copy lock by value
2021-12-17 13:19:23 -08:00
David Zhao
2d93ccd668 Updated protocol from protocol/proto -> protocol/livekit (#242)
* Updated protocol from protocol/proto -> protocol/livekit

* separate MediaTrack from PublishedTrack
2021-12-08 13:58:38 -08:00
David Colburn
991c334d2d telemetry interfaces (#210)
* telemetry interfaces

* move AddUptrack under stats

* regenerate

* a space

* consistency

* fix test
2021-11-24 17:58:04 -08:00
shishirng
5cdb1c4848 Send room name along in stat message (#205)
Signed-off-by: shishir gowda <shishir@livekit.io>
2021-11-23 15:51:16 -05:00
David Colburn
92838d75a8 Analytics events + stats (#187)
* events

* bump

* update incoming stats

* publisher stats

* outgoing rtcp

* stats

* remove unnecessary struct

* merge mediaTrack

* put comment back
2021-11-12 16:36:10 -06:00
David Colburn
bf46e998b2 Sfu/buffer stats for telemetry (#173)
* more buffer stats for analytics

* update names

* fix jitter and lost rate

* don't return on participantLeft if they never published
2021-11-09 02:06:07 -06:00