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
This commit is contained in:
David Colburn
2021-11-09 02:06:07 -06:00
committed by GitHub
parent c5830f9060
commit bf46e998b2
9 changed files with 295 additions and 191 deletions
-64
View File
@@ -1,64 +0,0 @@
package telemetry
import (
"github.com/livekit/protocol/logger"
"github.com/pion/rtcp"
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
)
func (s *TelemetryService) HandleIncomingRTCP(participantID, identity string, bytes []byte) {
pkts, err := rtcp.Unmarshal(bytes)
if err != nil {
logger.Errorw("Interceptor failed to unmarshal rtcp packets", err)
return
}
s.pool.Submit(func() {
for _, pkt := range pkts {
switch pkt.(type) {
case *rtcp.TransportLayerNack:
prometheus.IncrementNack(prometheus.Incoming)
case *rtcp.PictureLossIndication:
prometheus.IncrementPLI(prometheus.Incoming)
case *rtcp.FullIntraRequest:
prometheus.IncrementFIR(prometheus.Incoming)
}
}
})
// TODO: analytics service
}
func (s *TelemetryService) HandleIncomingRTP(participantID, identity string, pktLen uint64) {
s.pool.Submit(func() {
prometheus.IncrementPackets(prometheus.Incoming, pktLen)
})
// TODO: analytics service
}
func (s *TelemetryService) HandleOutgoingRTCP(participantID, identity string, pkts []rtcp.Packet) {
s.pool.Submit(func() {
for _, pkt := range pkts {
switch pkt.(type) {
case *rtcp.TransportLayerNack:
prometheus.IncrementNack(prometheus.Outgoing)
case *rtcp.PictureLossIndication:
prometheus.IncrementPLI(prometheus.Outgoing)
case *rtcp.FullIntraRequest:
prometheus.IncrementFIR(prometheus.Outgoing)
}
}
})
// TODO: analytics service
}
func (s *TelemetryService) HandleOutgoingRTP(participantID, identity string, pktLen uint64) {
s.pool.Submit(func() {
prometheus.IncrementPackets(prometheus.Outgoing, pktLen)
})
// TODO: analytics service
}