From a51abe93b62f7e0cc601eb88284046f6355f7a05 Mon Sep 17 00:00:00 2001 From: Takeru Ohta Date: Thu, 19 Dec 2024 10:36:34 +0900 Subject: [PATCH] Add total_sent_srtp_sfu_delay_us handling --- collector/sora_api.go | 1 + collector/srtp.go | 4 ++++ main_test.go | 2 ++ test/maximum.metrics | 3 +++ test/minimum.metrics | 3 +++ test/sora_client_enabled.metrics | 3 +++ test/sora_cluster_metrics_enabled.metrics | 3 +++ test/sora_connection_error_enabled.metrics | 3 +++ test/sora_erlang_vm_enabled.metrics | 3 +++ 9 files changed, 25 insertions(+) diff --git a/collector/sora_api.go b/collector/sora_api.go index 67031d4..aa92016 100644 --- a/collector/sora_api.go +++ b/collector/sora_api.go @@ -51,6 +51,7 @@ type soraSrtpReport struct { TotalReceivedSrtpByteSize int64 `json:"total_received_srtp_byte_size"` TotalSentSrtp int64 `json:"total_sent_srtp"` TotalSentSrtpByteSize int64 `json:"total_sent_srtp_byte_size"` + TotalSentSrtpSfuDelayUs int64 `json:"total_sent_srtp_sfu_delay_us"` TotalDecryptedSrtp int64 `json:"total_decrypted_srtp"` TotalDecryptedSrtpByteSize int64 `json:"total_decrypted_srtp_byte_size"` } diff --git a/collector/srtp.go b/collector/srtp.go index dc500c6..4fc13ee 100644 --- a/collector/srtp.go +++ b/collector/srtp.go @@ -8,6 +8,7 @@ var ( totalReceivedSrtpByteSize: newDesc("srtp_received_bytes_total", "The total number of received SRTP bytes."), totalSentSrtp: newDesc("srtp_sent_packets_total", "The total number of sent SRTP packets."), totalSentSrtpByteSize: newDesc("srtp_sent_bytes_total", "The total number of sent SRTP bytes."), + totalSentSrtpSfuDelayUs: newDesc("srtp_sent_sfu_delay_us_total", "The total delay introduced by the SFU during the transfer of SRTP packets."), totalDecryptedSrtp: newDesc("srtp_decrypted_packets_total", "The total number of decrpyted SRTP packets."), totalDecryptedSrtpByteSize: newDesc("srtp_decrpyted_bytes_total", "The total number of decrypted SRTP bytes."), } @@ -18,6 +19,7 @@ type SrtpMetrics struct { totalReceivedSrtpByteSize *prometheus.Desc totalSentSrtp *prometheus.Desc totalSentSrtpByteSize *prometheus.Desc + totalSentSrtpSfuDelayUs *prometheus.Desc totalDecryptedSrtp *prometheus.Desc totalDecryptedSrtpByteSize *prometheus.Desc } @@ -27,6 +29,7 @@ func (m *SrtpMetrics) Describe(ch chan<- *prometheus.Desc) { ch <- m.totalReceivedSrtpByteSize ch <- m.totalSentSrtp ch <- m.totalSentSrtpByteSize + ch <- m.totalSentSrtpSfuDelayUs ch <- m.totalDecryptedSrtp ch <- m.totalDecryptedSrtpByteSize } @@ -36,6 +39,7 @@ func (m *SrtpMetrics) Collect(ch chan<- prometheus.Metric, report soraSrtpReport ch <- newCounter(m.totalReceivedSrtpByteSize, float64(report.TotalReceivedSrtpByteSize)) ch <- newCounter(m.totalSentSrtp, float64(report.TotalSentSrtp)) ch <- newCounter(m.totalSentSrtpByteSize, float64(report.TotalSentSrtpByteSize)) + ch <- newCounter(m.totalSentSrtpSfuDelayUs, float64(report.TotalSentSrtpSfuDelayUs)) ch <- newCounter(m.totalDecryptedSrtp, float64(report.TotalDecryptedSrtp)) ch <- newCounter(m.totalDecryptedSrtpByteSize, float64(report.TotalDecryptedSrtpByteSize)) } diff --git a/main_test.go b/main_test.go index 34dcb9c..3ec7c00 100644 --- a/main_test.go +++ b/main_test.go @@ -166,6 +166,7 @@ var ( "total_sent_sctp_byte_size": 111, "total_sent_srtp": 106, "total_sent_srtp_byte_size": 107, + "total_sent_srtp_sfu_delay_us": 123456, "total_session_created": 1, "total_session_destroyed": 0, "total_successful_auth_webhook": 96, @@ -435,6 +436,7 @@ func TestMinimumMetrics(t *testing.T) { "total_sent_sctp_byte_size": 111, "total_sent_srtp": 106, "total_sent_srtp_byte_size": 107, + "total_sent_srtp_sfu_delay_us": 123456, "total_session_created": 111, "total_session_destroyed": 222, "total_successful_auth_webhook": 96, diff --git a/test/maximum.metrics b/test/maximum.metrics index 9dc08c0..8f93f55 100644 --- a/test/maximum.metrics +++ b/test/maximum.metrics @@ -220,6 +220,9 @@ sora_srtp_received_packets_total 108 # HELP sora_srtp_sent_bytes_total The total number of sent SRTP bytes. # TYPE sora_srtp_sent_bytes_total counter sora_srtp_sent_bytes_total 107 +# HELP sora_srtp_sent_sfu_delay_us_total The total delay introduced by the SFU during the transfer of SRTP packets. +# TYPE sora_srtp_sent_sfu_delay_us_total counter +sora_srtp_sent_sfu_delay_us_total 123456 # HELP sora_srtp_sent_packets_total The total number of sent SRTP packets. # TYPE sora_srtp_sent_packets_total counter sora_srtp_sent_packets_total 106 diff --git a/test/minimum.metrics b/test/minimum.metrics index 47ed127..73dd11c 100644 --- a/test/minimum.metrics +++ b/test/minimum.metrics @@ -74,6 +74,9 @@ sora_srtp_received_packets_total 108 # HELP sora_srtp_sent_bytes_total The total number of sent SRTP bytes. # TYPE sora_srtp_sent_bytes_total counter sora_srtp_sent_bytes_total 107 +# HELP sora_srtp_sent_sfu_delay_us_total The total delay introduced by the SFU during the transfer of SRTP packets. +# TYPE sora_srtp_sent_sfu_delay_us_total counter +sora_srtp_sent_sfu_delay_us_total 123456 # HELP sora_srtp_sent_packets_total The total number of sent SRTP packets. # TYPE sora_srtp_sent_packets_total counter sora_srtp_sent_packets_total 106 diff --git a/test/sora_client_enabled.metrics b/test/sora_client_enabled.metrics index ccb12bb..02599e9 100644 --- a/test/sora_client_enabled.metrics +++ b/test/sora_client_enabled.metrics @@ -105,6 +105,9 @@ sora_srtp_received_packets_total 108 # HELP sora_srtp_sent_bytes_total The total number of sent SRTP bytes. # TYPE sora_srtp_sent_bytes_total counter sora_srtp_sent_bytes_total 107 +# HELP sora_srtp_sent_sfu_delay_us_total The total delay introduced by the SFU during the transfer of SRTP packets. +# TYPE sora_srtp_sent_sfu_delay_us_total counter +sora_srtp_sent_sfu_delay_us_total 123456 # HELP sora_srtp_sent_packets_total The total number of sent SRTP packets. # TYPE sora_srtp_sent_packets_total counter sora_srtp_sent_packets_total 106 diff --git a/test/sora_cluster_metrics_enabled.metrics b/test/sora_cluster_metrics_enabled.metrics index fa234ba..88999b1 100644 --- a/test/sora_cluster_metrics_enabled.metrics +++ b/test/sora_cluster_metrics_enabled.metrics @@ -107,6 +107,9 @@ sora_srtp_received_packets_total 108 # HELP sora_srtp_sent_bytes_total The total number of sent SRTP bytes. # TYPE sora_srtp_sent_bytes_total counter sora_srtp_sent_bytes_total 107 +# HELP sora_srtp_sent_sfu_delay_us_total The total delay introduced by the SFU during the transfer of SRTP packets. +# TYPE sora_srtp_sent_sfu_delay_us_total counter +sora_srtp_sent_sfu_delay_us_total 123456 # HELP sora_srtp_sent_packets_total The total number of sent SRTP packets. # TYPE sora_srtp_sent_packets_total counter sora_srtp_sent_packets_total 106 diff --git a/test/sora_connection_error_enabled.metrics b/test/sora_connection_error_enabled.metrics index a9a7eef..9c325d9 100644 --- a/test/sora_connection_error_enabled.metrics +++ b/test/sora_connection_error_enabled.metrics @@ -81,6 +81,9 @@ sora_srtp_received_packets_total 108 # HELP sora_srtp_sent_bytes_total The total number of sent SRTP bytes. # TYPE sora_srtp_sent_bytes_total counter sora_srtp_sent_bytes_total 107 +# HELP sora_srtp_sent_sfu_delay_us_total The total delay introduced by the SFU during the transfer of SRTP packets. +# TYPE sora_srtp_sent_sfu_delay_us_total counter +sora_srtp_sent_sfu_delay_us_total 123456 # HELP sora_srtp_sent_packets_total The total number of sent SRTP packets. # TYPE sora_srtp_sent_packets_total counter sora_srtp_sent_packets_total 106 diff --git a/test/sora_erlang_vm_enabled.metrics b/test/sora_erlang_vm_enabled.metrics index d5e3a1b..b1726d8 100644 --- a/test/sora_erlang_vm_enabled.metrics +++ b/test/sora_erlang_vm_enabled.metrics @@ -158,6 +158,9 @@ sora_srtp_received_packets_total 108 # HELP sora_srtp_sent_bytes_total The total number of sent SRTP bytes. # TYPE sora_srtp_sent_bytes_total counter sora_srtp_sent_bytes_total 107 +# HELP sora_srtp_sent_sfu_delay_us_total The total delay introduced by the SFU during the transfer of SRTP packets. +# TYPE sora_srtp_sent_sfu_delay_us_total counter +sora_srtp_sent_sfu_delay_us_total 123456 # HELP sora_srtp_sent_packets_total The total number of sent SRTP packets. # TYPE sora_srtp_sent_packets_total counter sora_srtp_sent_packets_total 106