* 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
This commit is contained in:
Raja Subramanian
2022-02-08 12:53:14 +05:30
committed by GitHub
parent a6eb4290d3
commit 36289bbca7
23 changed files with 913 additions and 639 deletions
+22 -5
View File
@@ -4,10 +4,9 @@ import (
"context"
"github.com/gammazero/workerpool"
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/webhook"
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
)
type TelemetryServiceInternal interface {
@@ -45,7 +44,15 @@ func (t *telemetryServiceInternal) TrackStats(streamType livekit.StreamType, par
direction = prometheus.Outgoing
}
prometheus.IncrementRTCP(direction, stat.NackCount, stat.PliCount, stat.FirCount)
totalNACKs := uint32(0)
totalPLIs := uint32(0)
totalFIRs := uint32(0)
for _, stream := range stat.Streams {
totalNACKs += stream.TotalNacks
totalPLIs += stream.TotalPlis
totalFIRs += stream.TotalFirs
}
prometheus.IncrementRTCP(direction, totalNACKs, totalPLIs, totalFIRs)
w := t.workers[participantID]
if w != nil {
@@ -55,13 +62,23 @@ func (t *telemetryServiceInternal) TrackStats(streamType livekit.StreamType, par
func (t *telemetryServiceInternal) Report(ctx context.Context, stats []*livekit.AnalyticsStat) {
for _, stat := range stats {
if len(stat.Streams) == 0 {
continue
}
direction := prometheus.Incoming
if stat.Kind == livekit.StreamType_DOWNSTREAM {
direction = prometheus.Outgoing
}
prometheus.IncrementPackets(direction, stat.TotalPackets)
prometheus.IncrementBytes(direction, stat.TotalBytes)
totalPackets := uint32(0)
totalBytes := uint64(0)
for _, stream := range stat.Streams {
totalPackets += (stream.TotalPrimaryPackets + stream.TotalRetransmitPackets + stream.TotalPaddingPackets)
totalBytes += (stream.TotalPrimaryBytes + stream.TotalRetransmitBytes + stream.TotalPaddingBytes)
}
prometheus.IncrementPackets(direction, uint64(totalPackets))
prometheus.IncrementBytes(direction, totalBytes)
}
t.analytics.SendStats(ctx, stats)