Sample data send error logging. (#4358)
There are cases where data channel is not created potentially and logging on every one of those errors is verbose.
This commit is contained in:
@@ -124,7 +124,8 @@ type TransportManager struct {
|
|||||||
|
|
||||||
onICEConfigChanged func(iceConfig *livekit.ICEConfig)
|
onICEConfigChanged func(iceConfig *livekit.ICEConfig)
|
||||||
|
|
||||||
droppedBySlowReaderCount atomic.Uint32
|
dataChannelSendErrorDroppedBySlowReaderCount atomic.Uint32
|
||||||
|
dataChannelSendErrorCount atomic.Uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTransportManager(params TransportManagerParams) (*TransportManager, error) {
|
func NewTransportManager(params TransportManagerParams) (*TransportManager, error) {
|
||||||
@@ -355,12 +356,12 @@ func (t *TransportManager) handleSendDataResult(err error, kind string, size int
|
|||||||
io.ErrClosedPipe,
|
io.ErrClosedPipe,
|
||||||
sctp.ErrStreamClosed,
|
sctp.ErrStreamClosed,
|
||||||
ErrTransportFailure,
|
ErrTransportFailure,
|
||||||
ErrDataChannelBufferFull,
|
ErrDataChannelUnavailable,
|
||||||
context.DeadlineExceeded,
|
context.DeadlineExceeded,
|
||||||
datachannel.ErrDataDroppedByHighBufferedAmount,
|
datachannel.ErrDataDroppedByHighBufferedAmount,
|
||||||
) {
|
) {
|
||||||
if errors.Is(err, datachannel.ErrDataDroppedBySlowReader) {
|
if errors.Is(err, datachannel.ErrDataDroppedBySlowReader) {
|
||||||
droppedBySlowReaderCount := t.droppedBySlowReaderCount.Inc()
|
droppedBySlowReaderCount := t.dataChannelSendErrorDroppedBySlowReaderCount.Inc()
|
||||||
if (droppedBySlowReaderCount-1)%100 == 0 {
|
if (droppedBySlowReaderCount-1)%100 == 0 {
|
||||||
t.params.Logger.Infow(
|
t.params.Logger.Infow(
|
||||||
"drop data message by slow reader",
|
"drop data message by slow reader",
|
||||||
@@ -370,7 +371,15 @@ func (t *TransportManager) handleSendDataResult(err error, kind string, size int
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t.params.Logger.Warnw("send data message error", err)
|
count := t.dataChannelSendErrorCount.Inc()
|
||||||
|
if (count-1)%100 == 0 {
|
||||||
|
t.params.Logger.Infow(
|
||||||
|
"send data message error",
|
||||||
|
"error", err,
|
||||||
|
"kind", kind,
|
||||||
|
"count", count,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if utils.ErrorIsOneOf(err, sctp.ErrStreamClosed, io.ErrClosedPipe) {
|
if utils.ErrorIsOneOf(err, sctp.ErrStreamClosed, io.ErrClosedPipe) {
|
||||||
|
|||||||
Reference in New Issue
Block a user