Add counter for pub&sub time metrics (#3084)
* Add counter for pub&sub time metrics The pub&sub shows large value in migration related case like muted/disabled migration, the subscription time depends on the time when publisher unmute the track(sending rtp packet after migration), add a counter to distinguish since we can't control the time in such cases and the first subscription attemps also is more meaningful than those cases. * Add info log for high publish delay
This commit is contained in:
+18
-6
@@ -2231,12 +2231,24 @@ func (p *ParticipantImpl) mediaTrackReceived(track *webrtc.TrackRemote, rtpRecei
|
||||
|
||||
if newTrack {
|
||||
go func() {
|
||||
p.pubLogger.Debugw(
|
||||
"track published",
|
||||
"trackID", mt.ID(),
|
||||
"track", logger.Proto(mt.ToProto()),
|
||||
"cost", pubTime.Milliseconds(),
|
||||
)
|
||||
// TODO: remove this after we know where the high delay is coming from
|
||||
if pubTime > 3*time.Second {
|
||||
p.pubLogger.Infow(
|
||||
"track published with high delay",
|
||||
"trackID", mt.ID(),
|
||||
"track", logger.Proto(mt.ToProto()),
|
||||
"cost", pubTime.Milliseconds(),
|
||||
"rid", track.RID(),
|
||||
"mime", track.Codec().MimeType,
|
||||
)
|
||||
} else {
|
||||
p.pubLogger.Debugw(
|
||||
"track published",
|
||||
"trackID", mt.ID(),
|
||||
"track", logger.Proto(mt.ToProto()),
|
||||
"cost", pubTime.Milliseconds(),
|
||||
)
|
||||
}
|
||||
|
||||
prometheus.RecordPublishTime(mt.Source(), mt.Kind(), pubTime, p.GetClientInfo().GetSdk(), p.Kind())
|
||||
p.handleTrackPublished(mt)
|
||||
|
||||
Reference in New Issue
Block a user