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
+13 -7
View File
@@ -57,15 +57,21 @@ func initPacketStats() {
prometheus.MustRegister(promFirTotal)
}
func IncrementPackets(direction Direction, pktLen uint64) {
promPacketTotal.WithLabelValues(string(direction)).Add(1)
promPacketBytes.WithLabelValues(string(direction)).Add(float64(pktLen))
func IncrementPackets(direction Direction, count uint64) {
promPacketTotal.WithLabelValues(string(direction)).Add(float64(count))
if direction == Incoming {
atomic.AddUint64(&atomicPacketsIn, 1)
atomic.AddUint64(&atomicBytesIn, pktLen)
atomic.AddUint64(&atomicPacketsIn, count)
} else {
atomic.AddUint64(&atomicPacketsOut, 1)
atomic.AddUint64(&atomicBytesOut, pktLen)
atomic.AddUint64(&atomicPacketsOut, count)
}
}
func IncrementBytes(direction Direction, count uint64) {
promPacketBytes.WithLabelValues(string(direction)).Add(float64(count))
if direction == Incoming {
atomic.AddUint64(&atomicBytesIn, count)
} else {
atomic.AddUint64(&atomicBytesOut, count)
}
}