-
Notifications
You must be signed in to change notification settings - Fork 996
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add metrics for queue drops/exceptions.
- Loading branch information
Showing
10 changed files
with
243 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright @ 2024 - present 8x8, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jitsi.videobridge | ||
|
||
import org.jitsi.utils.queue.CountingErrorHandler | ||
import org.jitsi.utils.queue.PacketQueue | ||
import org.jitsi.videobridge.metrics.QueueMetrics | ||
import org.jitsi.videobridge.metrics.VideobridgeMetricsContainer | ||
import org.jitsi.videobridge.util.TaskPools | ||
import org.jitsi.videobridge.xmpp.XmppConnection | ||
import java.time.Clock | ||
import kotlin.Int.Companion.MAX_VALUE | ||
|
||
abstract class ColibriQueue(packetHandler: PacketHandler<XmppConnection.ColibriRequest>) : | ||
PacketQueue<XmppConnection.ColibriRequest>( | ||
MAX_VALUE, | ||
true, | ||
QUEUE_NAME, | ||
packetHandler, | ||
TaskPools.IO_POOL, | ||
// TODO: using the Videobridge clock breaks tests somehow | ||
Clock.systemUTC(), | ||
// Allow running tasks to complete (so we can close the queue from within the task. | ||
false, | ||
) { | ||
init { | ||
setErrorHandler(queueErrorCounter) | ||
} | ||
|
||
companion object { | ||
val QUEUE_NAME = "colibri-queue" | ||
|
||
val droppedPacketsMetric = VideobridgeMetricsContainer.instance.registerCounter( | ||
"colibri_queue_dropped_packets", | ||
"Number of packets dropped out of the Colibri queue." | ||
) | ||
|
||
val exceptionsMetric = VideobridgeMetricsContainer.instance.registerCounter( | ||
"colibri_queue_exceptions", | ||
"Number of exceptions from the Colibri queue." | ||
) | ||
|
||
/** Count the number of dropped packets and exceptions. */ | ||
val queueErrorCounter = object : CountingErrorHandler() { | ||
override fun packetDropped() = super.packetDropped().also { | ||
droppedPacketsMetric.inc() | ||
QueueMetrics.droppedPackets.inc() | ||
} | ||
override fun packetHandlingFailed(t: Throwable?) = super.packetHandlingFailed(t).also { | ||
exceptionsMetric.inc() | ||
QueueMetrics.exceptions.inc() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
jvb/src/main/kotlin/org/jitsi/videobridge/metrics/QueueMetrics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright @ 2024 - present 8x8, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jitsi.videobridge.metrics | ||
|
||
import org.jitsi.nlj.RtpReceiverImpl | ||
import org.jitsi.nlj.RtpSenderImpl | ||
import org.jitsi.utils.queue.CountingErrorHandler | ||
import org.jitsi.videobridge.metrics.VideobridgeMetricsContainer.Companion.instance as metricsContainer | ||
|
||
object QueueMetrics { | ||
private val rtpReceiverDroppedPackets = metricsContainer.registerCounter( | ||
"rtp_receiver_dropped_packets", | ||
"Number of packets dropped out of the RTP receiver queue." | ||
) | ||
private val rtpReceiverExceptions = metricsContainer.registerCounter( | ||
"rtp_receiver_exceptions", | ||
"Number of exceptions from the RTP receiver queue." | ||
) | ||
private val rtpSenderDroppedPackets = metricsContainer.registerCounter( | ||
"rtp_sender_dropped_packets", | ||
"Number of packets dropped out of the RTP sender queue." | ||
) | ||
private val rtpSenderExceptions = metricsContainer.registerCounter( | ||
"rtp_sender_exceptions", | ||
"Number of exceptions from the RTP sender queue." | ||
) | ||
|
||
val droppedPackets = metricsContainer.registerCounter( | ||
"queue_dropped_packets", | ||
"Number of packets dropped from any of the queues." | ||
) | ||
val exceptions = metricsContainer.registerCounter( | ||
"queue_exceptions", | ||
"Number of exceptions from any of the queues." | ||
) | ||
|
||
fun init() { | ||
RtpReceiverImpl.queueErrorCounter = object : CountingErrorHandler() { | ||
override fun packetDropped() = super.packetDropped().also { | ||
rtpReceiverDroppedPackets.inc() | ||
droppedPackets.inc() | ||
} | ||
override fun packetHandlingFailed(t: Throwable?) = super.packetHandlingFailed(t).also { | ||
rtpReceiverExceptions.inc() | ||
exceptions.inc() | ||
} | ||
} | ||
|
||
RtpSenderImpl.queueErrorCounter = object : CountingErrorHandler() { | ||
override fun packetDropped() = super.packetDropped().also { | ||
rtpSenderDroppedPackets.inc() | ||
droppedPackets.inc() | ||
} | ||
override fun packetHandlingFailed(t: Throwable?) = super.packetHandlingFailed(t).also { | ||
rtpSenderExceptions.inc() | ||
exceptions.inc() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters