Skip to content

Commit

Permalink
Expose dcsctp metrics in sctpTransport debug state.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanLennox committed May 16, 2024
1 parent 0139354 commit 846bd94
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jvb/src/main/kotlin/org/jitsi/videobridge/Endpoint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,9 @@ class Endpoint @JvmOverloads constructor(
put("audioSsrcs", audioSsrcs.getDebugState())
put("videoSsrcs", videoSsrcs.getDebugState())
}
sctpTransport?.let {
put("sctp", it.getDebugState())
}
}

override fun expire() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.jitsi.dcsctp4j.DcSctpSocketInterface
import org.jitsi.dcsctp4j.SendOptions
import org.jitsi.dcsctp4j.Timeout
import org.jitsi.nlj.PacketInfo
import org.jitsi.utils.OrderedJsonObject
import org.jitsi.utils.logging2.Logger
import org.jitsi.utils.logging2.createChildLogger
import org.jitsi.videobridge.util.TaskPools
Expand All @@ -48,6 +49,29 @@ class DcSctpTransport(
socket.receivePacket(packet.getBuffer(), packet.getOffset(), packet.getLength())
}

fun getDebugState(): OrderedJsonObject {
val metrics = socket.metrics
return OrderedJsonObject().apply {
if (metrics != null) {
put("tx_packets_count", metrics.txPacketsCount)
put("tx_messages_count", metrics.txMessagesCount)
put("rtx_packets_count", metrics.rtxPacketsCount)
put("rtx_bytes_count", metrics.rtxBytesCount)
put("cwnd_bytes", metrics.cwndBytes)
put("srtt_ms", metrics.srttMs)
put("unack_data_count", metrics.unackDataCount)
put("rx_packets_count", metrics.rxPacketsCount)
put("rx_messages_count", metrics.rxMessagesCount)
put("peer_rwnd_bytes", metrics.peerRwndBytes)
put("peer_implementation", metrics.peerImplementation.name)
put("uses_message_interleaving", metrics.usesMessageInterleaving())
put("uses_zero_checksum", metrics.usesZeroChecksum())
put("negotiated_maximum_incoming_streams", metrics.negotiatedMaximumIncomingStreams)
put("negotiated_maximum_outgoing_streams", metrics.negotiatedMaximumOutgoingStreams)
}
}
}

companion object {
private val factory = DcSctpSocketFactory()

Expand Down
3 changes: 3 additions & 0 deletions jvb/src/main/kotlin/org/jitsi/videobridge/relay/Relay.kt
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ class Relay @JvmOverloads constructor(
endpointSenders[s.id] = s.getDebugState()
}
put("senders", endpointSenders)
sctpTransport?.let {
put("sctp", it.getDebugState())
}
}

private fun setupIceTransport() {
Expand Down

0 comments on commit 846bd94

Please sign in to comment.