mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 11:32:19 +08:00
Add Req/Res count/time to candidate stats (#3043)
See https://github.com/pion/ice/pull/763
This commit is contained in:
2
go.mod
2
go.mod
@@ -5,7 +5,7 @@ go 1.20
|
|||||||
require (
|
require (
|
||||||
github.com/pion/datachannel v1.5.10
|
github.com/pion/datachannel v1.5.10
|
||||||
github.com/pion/dtls/v3 v3.0.4
|
github.com/pion/dtls/v3 v3.0.4
|
||||||
github.com/pion/ice/v4 v4.0.6
|
github.com/pion/ice/v4 v4.0.7
|
||||||
github.com/pion/interceptor v0.1.37
|
github.com/pion/interceptor v0.1.37
|
||||||
github.com/pion/logging v0.2.3
|
github.com/pion/logging v0.2.3
|
||||||
github.com/pion/randutil v0.1.0
|
github.com/pion/randutil v0.1.0
|
||||||
|
4
go.sum
4
go.sum
@@ -39,8 +39,8 @@ github.com/pion/datachannel v1.5.10 h1:ly0Q26K1i6ZkGf42W7D4hQYR90pZwzFOjTq5AuCKk
|
|||||||
github.com/pion/datachannel v1.5.10/go.mod h1:p/jJfC9arb29W7WrxyKbepTU20CFgyx5oLo8Rs4Py/M=
|
github.com/pion/datachannel v1.5.10/go.mod h1:p/jJfC9arb29W7WrxyKbepTU20CFgyx5oLo8Rs4Py/M=
|
||||||
github.com/pion/dtls/v3 v3.0.4 h1:44CZekewMzfrn9pmGrj5BNnTMDCFwr+6sLH+cCuLM7U=
|
github.com/pion/dtls/v3 v3.0.4 h1:44CZekewMzfrn9pmGrj5BNnTMDCFwr+6sLH+cCuLM7U=
|
||||||
github.com/pion/dtls/v3 v3.0.4/go.mod h1:R373CsjxWqNPf6MEkfdy3aSe9niZvL/JaKlGeFphtMg=
|
github.com/pion/dtls/v3 v3.0.4/go.mod h1:R373CsjxWqNPf6MEkfdy3aSe9niZvL/JaKlGeFphtMg=
|
||||||
github.com/pion/ice/v4 v4.0.6 h1:jmM9HwI9lfetQV/39uD0nY4y++XZNPhvzIPCb8EwxUM=
|
github.com/pion/ice/v4 v4.0.7 h1:mnwuT3n3RE/9va41/9QJqN5+Bhc0H/x/ZyiVlWMw35M=
|
||||||
github.com/pion/ice/v4 v4.0.6/go.mod h1:y3M18aPhIxLlcO/4dn9X8LzLLSma84cx6emMSu14FGw=
|
github.com/pion/ice/v4 v4.0.7/go.mod h1:y3M18aPhIxLlcO/4dn9X8LzLLSma84cx6emMSu14FGw=
|
||||||
github.com/pion/interceptor v0.1.37 h1:aRA8Zpab/wE7/c0O3fh1PqY0AJI3fCSEM5lRWJVorwI=
|
github.com/pion/interceptor v0.1.37 h1:aRA8Zpab/wE7/c0O3fh1PqY0AJI3fCSEM5lRWJVorwI=
|
||||||
github.com/pion/interceptor v0.1.37/go.mod h1:JzxbJ4umVTlZAf+/utHzNesY8tmRkM2lVmkS82TTj8Y=
|
github.com/pion/interceptor v0.1.37/go.mod h1:JzxbJ4umVTlZAf+/utHzNesY8tmRkM2lVmkS82TTj8Y=
|
||||||
github.com/pion/logging v0.2.3 h1:gHuf0zpoh1GW67Nr6Gj4cv5Z9ZscU7g/EaoC/Ke/igI=
|
github.com/pion/logging v0.2.3 h1:gHuf0zpoh1GW67Nr6Gj4cv5Z9ZscU7g/EaoC/Ke/igI=
|
||||||
|
15
stats.go
15
stats.go
@@ -2053,7 +2053,10 @@ func toICECandidatePairStats(candidatePairStats ice.CandidatePairStats) (ICECand
|
|||||||
LastPacketReceivedTimestamp: statsTimestampFrom(candidatePairStats.LastPacketReceivedTimestamp),
|
LastPacketReceivedTimestamp: statsTimestampFrom(candidatePairStats.LastPacketReceivedTimestamp),
|
||||||
FirstRequestTimestamp: statsTimestampFrom(candidatePairStats.FirstRequestTimestamp),
|
FirstRequestTimestamp: statsTimestampFrom(candidatePairStats.FirstRequestTimestamp),
|
||||||
LastRequestTimestamp: statsTimestampFrom(candidatePairStats.LastRequestTimestamp),
|
LastRequestTimestamp: statsTimestampFrom(candidatePairStats.LastRequestTimestamp),
|
||||||
|
FirstResponseTimestamp: statsTimestampFrom(candidatePairStats.FirstResponseTimestamp),
|
||||||
LastResponseTimestamp: statsTimestampFrom(candidatePairStats.LastResponseTimestamp),
|
LastResponseTimestamp: statsTimestampFrom(candidatePairStats.LastResponseTimestamp),
|
||||||
|
FirstRequestReceivedTimestamp: statsTimestampFrom(candidatePairStats.FirstRequestReceivedTimestamp),
|
||||||
|
LastRequestReceivedTimestamp: statsTimestampFrom(candidatePairStats.LastRequestReceivedTimestamp),
|
||||||
TotalRoundTripTime: candidatePairStats.TotalRoundTripTime,
|
TotalRoundTripTime: candidatePairStats.TotalRoundTripTime,
|
||||||
CurrentRoundTripTime: candidatePairStats.CurrentRoundTripTime,
|
CurrentRoundTripTime: candidatePairStats.CurrentRoundTripTime,
|
||||||
AvailableOutgoingBitrate: candidatePairStats.AvailableOutgoingBitrate,
|
AvailableOutgoingBitrate: candidatePairStats.AvailableOutgoingBitrate,
|
||||||
@@ -2163,10 +2166,22 @@ type ICECandidatePairStats struct {
|
|||||||
// (LastRequestTimestamp - FirstRequestTimestamp) / RequestsSent.
|
// (LastRequestTimestamp - FirstRequestTimestamp) / RequestsSent.
|
||||||
LastRequestTimestamp StatsTimestamp `json:"lastRequestTimestamp"`
|
LastRequestTimestamp StatsTimestamp `json:"lastRequestTimestamp"`
|
||||||
|
|
||||||
|
// FirstResponseTimestamp represents the timestamp at which the first STUN response
|
||||||
|
// was received on this particular candidate pair.
|
||||||
|
FirstResponseTimestamp StatsTimestamp `json:"firstResponseTimestamp"`
|
||||||
|
|
||||||
// LastResponseTimestamp represents the timestamp at which the last STUN response
|
// LastResponseTimestamp represents the timestamp at which the last STUN response
|
||||||
// was received on this particular candidate pair.
|
// was received on this particular candidate pair.
|
||||||
LastResponseTimestamp StatsTimestamp `json:"lastResponseTimestamp"`
|
LastResponseTimestamp StatsTimestamp `json:"lastResponseTimestamp"`
|
||||||
|
|
||||||
|
// FirstRequestReceivedTimestamp represents the timestamp at which the first
|
||||||
|
// connectivity check request was received.
|
||||||
|
FirstRequestReceivedTimestamp StatsTimestamp `json:"firstRequestReceivedTimestamp"`
|
||||||
|
|
||||||
|
// LastRequestReceivedTimestamp represents the timestamp at which the last
|
||||||
|
// connectivity check request was received.
|
||||||
|
LastRequestReceivedTimestamp StatsTimestamp `json:"lastRequestReceivedTimestamp"`
|
||||||
|
|
||||||
// TotalRoundTripTime represents the sum of all round trip time measurements
|
// TotalRoundTripTime represents the sum of all round trip time measurements
|
||||||
// in seconds since the beginning of the session, based on STUN connectivity
|
// in seconds since the beginning of the session, based on STUN connectivity
|
||||||
// check responses (ResponsesReceived), including those that reply to requests
|
// check responses (ResponsesReceived), including those that reply to requests
|
||||||
|
@@ -869,7 +869,10 @@ func getStatsSamples() []statSample { //nolint:cyclop,maintidx
|
|||||||
LastPacketReceivedTimestamp: 6,
|
LastPacketReceivedTimestamp: 6,
|
||||||
FirstRequestTimestamp: 7,
|
FirstRequestTimestamp: 7,
|
||||||
LastRequestTimestamp: 8,
|
LastRequestTimestamp: 8,
|
||||||
|
FirstResponseTimestamp: 9,
|
||||||
LastResponseTimestamp: 9,
|
LastResponseTimestamp: 9,
|
||||||
|
FirstRequestReceivedTimestamp: 9,
|
||||||
|
LastRequestReceivedTimestamp: 9,
|
||||||
TotalRoundTripTime: 10,
|
TotalRoundTripTime: 10,
|
||||||
CurrentRoundTripTime: 11,
|
CurrentRoundTripTime: 11,
|
||||||
AvailableOutgoingBitrate: 12,
|
AvailableOutgoingBitrate: 12,
|
||||||
@@ -904,7 +907,10 @@ func getStatsSamples() []statSample { //nolint:cyclop,maintidx
|
|||||||
"lastPacketReceivedTimestamp": 6,
|
"lastPacketReceivedTimestamp": 6,
|
||||||
"firstRequestTimestamp": 7,
|
"firstRequestTimestamp": 7,
|
||||||
"lastRequestTimestamp": 8,
|
"lastRequestTimestamp": 8,
|
||||||
|
"firstResponseTimestamp": 9,
|
||||||
"lastResponseTimestamp": 9,
|
"lastResponseTimestamp": 9,
|
||||||
|
"firstRequestReceivedTimestamp": 9,
|
||||||
|
"lastRequestReceivedTimestamp": 9,
|
||||||
"totalRoundTripTime": 10,
|
"totalRoundTripTime": 10,
|
||||||
"currentRoundTripTime": 11,
|
"currentRoundTripTime": 11,
|
||||||
"availableOutgoingBitrate": 12,
|
"availableOutgoingBitrate": 12,
|
||||||
|
Reference in New Issue
Block a user