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
This commit is contained in:
Raja Subramanian
2022-04-16 21:11:32 +05:30
committed by GitHub
parent 7a3e446a65
commit a98d955284
15 changed files with 506 additions and 581 deletions
+13 -13
View File
@@ -47,15 +47,15 @@ func (t *telemetryServiceInternal) TrackStats(streamType livekit.StreamType, par
direction = prometheus.Outgoing
}
totalNACKs := uint32(0)
totalPLIs := uint32(0)
totalFIRs := uint32(0)
nacks := uint32(0)
plis := uint32(0)
firs := uint32(0)
for _, stream := range stat.Streams {
totalNACKs += stream.TotalNacks
totalPLIs += stream.TotalPlis
totalFIRs += stream.TotalFirs
nacks += stream.Nacks
plis += stream.Plis
firs += stream.Firs
}
prometheus.IncrementRTCP(direction, totalNACKs, totalPLIs, totalFIRs)
prometheus.IncrementRTCP(direction, nacks, plis, firs)
w := t.workers[participantID]
if w != nil {
@@ -74,14 +74,14 @@ func (t *telemetryServiceInternal) Report(ctx context.Context, stats []*livekit.
direction = prometheus.Outgoing
}
totalPackets := uint32(0)
totalBytes := uint64(0)
packets := uint32(0)
bytes := uint64(0)
for _, stream := range stat.Streams {
totalPackets += stream.TotalPrimaryPackets + stream.TotalRetransmitPackets + stream.TotalPaddingPackets
totalBytes += stream.TotalPrimaryBytes + stream.TotalRetransmitBytes + stream.TotalPaddingBytes
packets += stream.PrimaryPackets + stream.RetransmitPackets + stream.PaddingPackets
bytes += stream.PrimaryBytes + stream.RetransmitBytes + stream.PaddingBytes
}
prometheus.IncrementPackets(direction, uint64(totalPackets))
prometheus.IncrementBytes(direction, totalBytes)
prometheus.IncrementPackets(direction, uint64(packets))
prometheus.IncrementBytes(direction, bytes)
}
t.analytics.SendStats(ctx, stats)