From 0c002b8675d7619271cadf7ce52a459be5855e8e Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Tue, 17 Sep 2024 01:42:21 +0000 Subject: [PATCH] exclude sip client from track publish metric (#3007) --- pkg/rtc/participant.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index f08370514..a22f0b17f 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -2133,7 +2133,13 @@ func (p *ParticipantImpl) mediaTrackReceived(track *webrtc.TrackRemote, rtpRecei "track", logger.Proto(mt.ToProto()), "cost", pubTime.Milliseconds(), ) - prometheus.RecordPublishTime(mt.Source(), mt.Kind(), pubTime) + + // SIP client relies on the remote peer's media packet to publish the track and + // sometimes it costs 10s to arrive after handshake. + // So we ignore the publish time for SIP client to avoid the high value in the metrics. + if p.Kind() != livekit.ParticipantInfo_SIP { + prometheus.RecordPublishTime(mt.Source(), mt.Kind(), pubTime) + } p.handleTrackPublished(mt) }() }