Skip to content

Commit

Permalink
Add total_sent_srtp_sfu_delay_us handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sile committed Dec 19, 2024
1 parent 0606d8e commit a51abe9
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions collector/sora_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
4 changes: 4 additions & 0 deletions collector/srtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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."),
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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))
}
2 changes: 2 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions test/maximum.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/minimum.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/sora_client_enabled.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/sora_cluster_metrics_enabled.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/sora_connection_error_enabled.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/sora_erlang_vm_enabled.metrics
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a51abe9

Please sign in to comment.