mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-09-26 19:51:26 +08:00
16
README.md
16
README.md
@@ -1980,6 +1980,14 @@ rtsp_conns_bytes_sent{id="[id]"} 187
|
||||
rtsp_sessions{id="[id]",state="idle"} 1
|
||||
rtsp_sessions_bytes_received{id="[id]",state="[state]"} 1234
|
||||
rtsp_sessions_bytes_sent{id="[id]",state="[state]"} 187
|
||||
rtsp_sessions_rtp_packets_received{id="[id]"} 123
|
||||
rtsp_sessions_rtp_packets_sent{id="[id]"} 123
|
||||
rtsp_sessions_rtp_packets_lost{id="[id]"} 123
|
||||
rtsp_sessions_rtp_packets_in_error{id="[id]"} 123
|
||||
rtsp_sessions_rtp_packets_jitter{id="[id]"} 123
|
||||
rtsp_sessions_rtcp_packets_received{id="[id]"} 123
|
||||
rtsp_sessions_rtcp_packets_sent{id="[id]"} 123
|
||||
rtsp_sessions_rtcp_packets_in_error{id="[id]"} 123
|
||||
|
||||
# metrics of every RTSPS connection
|
||||
rtsps_conns{id="[id]"} 1
|
||||
@@ -1990,6 +1998,14 @@ rtsps_conns_bytes_sent{id="[id]"} 187
|
||||
rtsps_sessions{id="[id]",state="[state]"} 1
|
||||
rtsps_sessions_bytes_received{id="[id]",state="[state]"} 1234
|
||||
rtsps_sessions_bytes_sent{id="[id]",state="[state]"} 187
|
||||
rtsps_sessions_rtp_packets_received{id="[id]"} 123
|
||||
rtsps_sessions_rtp_packets_sent{id="[id]"} 123
|
||||
rtsps_sessions_rtp_packets_lost{id="[id]"} 123
|
||||
rtsps_sessions_rtp_packets_in_error{id="[id]"} 123
|
||||
rtsps_sessions_rtp_packets_jitter{id="[id]"} 123
|
||||
rtsps_sessions_rtcp_packets_received{id="[id]"} 123
|
||||
rtsps_sessions_rtcp_packets_sent{id="[id]"} 123
|
||||
rtsps_sessions_rtcp_packets_in_error{id="[id]"} 123
|
||||
|
||||
# metrics of every RTMP connection
|
||||
rtmp_conns{id="[id]",state="[state]"} 1
|
||||
|
@@ -695,6 +695,30 @@ components:
|
||||
bytesSent:
|
||||
type: integer
|
||||
format: int64
|
||||
rtpPacketsReceived:
|
||||
type: integer
|
||||
format: int64
|
||||
rtpPacketsSent:
|
||||
type: integer
|
||||
format: int64
|
||||
rtpPacketsLost:
|
||||
type: integer
|
||||
format: int64
|
||||
rtpPacketsInError:
|
||||
type: integer
|
||||
format: int64
|
||||
rtpPacketsJitter:
|
||||
type: number
|
||||
format: float64
|
||||
rtcpPacketsReceived:
|
||||
type: integer
|
||||
format: int64
|
||||
rtcpPacketsSent:
|
||||
type: integer
|
||||
format: int64
|
||||
rtcpPacketsInError:
|
||||
type: integer
|
||||
format: int64
|
||||
|
||||
RTSPSessionList:
|
||||
type: object
|
||||
|
4
go.mod
4
go.mod
@@ -10,7 +10,7 @@ require (
|
||||
github.com/alecthomas/kong v1.6.0
|
||||
github.com/asticode/go-astits v1.13.0
|
||||
github.com/bluenviron/gohlslib/v2 v2.1.0
|
||||
github.com/bluenviron/gortsplib/v4 v4.11.2
|
||||
github.com/bluenviron/gortsplib/v4 v4.12.1-0.20241225143216-4d3d6bc108f3
|
||||
github.com/bluenviron/mediacommon v1.13.2
|
||||
github.com/datarhei/gosrt v0.8.0
|
||||
github.com/fsnotify/fsnotify v1.8.0
|
||||
@@ -88,7 +88,7 @@ require (
|
||||
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
|
||||
golang.org/x/arch v0.12.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.31.0 // indirect
|
||||
golang.org/x/net v0.33.0 // indirect
|
||||
golang.org/x/sync v0.10.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
|
8
go.sum
8
go.sum
@@ -33,8 +33,8 @@ github.com/benburkert/openpgp v0.0.0-20160410205803-c2471f86866c h1:8XZeJrs4+ZYh
|
||||
github.com/benburkert/openpgp v0.0.0-20160410205803-c2471f86866c/go.mod h1:x1vxHcL/9AVzuk5HOloOEPrtJY0MaalYr78afXZ+pWI=
|
||||
github.com/bluenviron/gohlslib/v2 v2.1.0 h1:I0KXXPjnt7QxsR39z97fKe/x1yj22e1NhSqZ5P6FbWE=
|
||||
github.com/bluenviron/gohlslib/v2 v2.1.0/go.mod h1:irD+TAdUsb400Gp8v80LKPPC4YumiAieUSO6ICykeWo=
|
||||
github.com/bluenviron/gortsplib/v4 v4.11.2 h1:V9WjA9sY99X0OiQyz/JgLOMeHaXyOcE3XsOIU+yQS4U=
|
||||
github.com/bluenviron/gortsplib/v4 v4.11.2/go.mod h1:H6bdvXU0+poDcR0etOvdcwsNKC/1xzAMVuBNO4hxeL4=
|
||||
github.com/bluenviron/gortsplib/v4 v4.12.1-0.20241225143216-4d3d6bc108f3 h1:9JqYzxhzIQhPqe5MIq2leJNARrs7VPNgL2o3qwmlgqA=
|
||||
github.com/bluenviron/gortsplib/v4 v4.12.1-0.20241225143216-4d3d6bc108f3/go.mod h1:MwFrCmflxvLTMjgtnPJ2H4SQSB/r9wX8nsR5YPtUs7M=
|
||||
github.com/bluenviron/mediacommon v1.13.2 h1:Ssq+59ZtPm5f9iAVVugWNOyl89Vp0G758RMv033lkik=
|
||||
github.com/bluenviron/mediacommon v1.13.2/go.mod h1:tffg+sPMErUIe7WMq7ZlYry/rPE6TyENWCrYT5JWcgs=
|
||||
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
|
||||
@@ -297,8 +297,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
|
||||
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
|
||||
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
|
||||
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
|
||||
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
|
||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
@@ -612,15 +612,23 @@ func TestAPIProtocolListGet(t *testing.T) {
|
||||
"itemCount": float64(1),
|
||||
"items": []interface{}{
|
||||
map[string]interface{}{
|
||||
"bytesReceived": float64(0),
|
||||
"bytesSent": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["bytesSent"],
|
||||
"created": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["created"],
|
||||
"id": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["id"],
|
||||
"path": "mypath",
|
||||
"query": "key=val",
|
||||
"remoteAddr": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["remoteAddr"],
|
||||
"state": "publish",
|
||||
"transport": "UDP",
|
||||
"bytesReceived": float64(0),
|
||||
"bytesSent": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["bytesSent"],
|
||||
"created": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["created"],
|
||||
"id": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["id"],
|
||||
"path": "mypath",
|
||||
"query": "key=val",
|
||||
"remoteAddr": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["remoteAddr"],
|
||||
"state": "publish",
|
||||
"transport": "UDP",
|
||||
"rtpPacketsReceived": float64(0),
|
||||
"rtpPacketsSent": float64(0),
|
||||
"rtpPacketsLost": float64(0),
|
||||
"rtpPacketsInError": float64(0),
|
||||
"rtpPacketsJitter": float64(0),
|
||||
"rtcpPacketsReceived": float64(0),
|
||||
"rtcpPacketsSent": float64(0),
|
||||
"rtcpPacketsInError": float64(0),
|
||||
},
|
||||
},
|
||||
}, out1)
|
||||
@@ -646,15 +654,23 @@ func TestAPIProtocolListGet(t *testing.T) {
|
||||
"itemCount": float64(1),
|
||||
"items": []interface{}{
|
||||
map[string]interface{}{
|
||||
"bytesReceived": float64(0),
|
||||
"bytesSent": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["bytesSent"],
|
||||
"created": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["created"],
|
||||
"id": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["id"],
|
||||
"path": "mypath",
|
||||
"query": "key=val",
|
||||
"remoteAddr": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["remoteAddr"],
|
||||
"state": "publish",
|
||||
"transport": "TCP",
|
||||
"bytesReceived": float64(0),
|
||||
"bytesSent": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["bytesSent"],
|
||||
"created": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["created"],
|
||||
"id": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["id"],
|
||||
"path": "mypath",
|
||||
"query": "key=val",
|
||||
"remoteAddr": out1.(map[string]interface{})["items"].([]interface{})[0].(map[string]interface{})["remoteAddr"],
|
||||
"state": "publish",
|
||||
"transport": "TCP",
|
||||
"rtpPacketsReceived": float64(0),
|
||||
"rtpPacketsSent": float64(0),
|
||||
"rtpPacketsLost": float64(0),
|
||||
"rtpPacketsInError": float64(0),
|
||||
"rtpPacketsJitter": float64(0),
|
||||
"rtcpPacketsReceived": float64(0),
|
||||
"rtcpPacketsSent": float64(0),
|
||||
"rtcpPacketsInError": float64(0),
|
||||
},
|
||||
},
|
||||
}, out1)
|
||||
|
@@ -83,12 +83,28 @@ rtsp_conns_bytes_sent 0
|
||||
rtsp_sessions 0
|
||||
rtsp_sessions_bytes_received 0
|
||||
rtsp_sessions_bytes_sent 0
|
||||
rtsp_sessions_rtp_packets_received 0
|
||||
rtsp_sessions_rtp_packets_sent 0
|
||||
rtsp_sessions_rtp_packets_lost 0
|
||||
rtsp_sessions_rtp_packets_in_error 0
|
||||
rtsp_sessions_rtp_packets_jitter 0
|
||||
rtsp_sessions_rtcp_packets_received 0
|
||||
rtsp_sessions_rtcp_packets_sent 0
|
||||
rtsp_sessions_rtcp_packets_in_error 0
|
||||
rtsps_conns 0
|
||||
rtsps_conns_bytes_received 0
|
||||
rtsps_conns_bytes_sent 0
|
||||
rtsps_sessions 0
|
||||
rtsps_sessions_bytes_received 0
|
||||
rtsps_sessions_bytes_sent 0
|
||||
rtsps_sessions_rtp_packets_received 0
|
||||
rtsps_sessions_rtp_packets_sent 0
|
||||
rtsps_sessions_rtp_packets_lost 0
|
||||
rtsps_sessions_rtp_packets_in_error 0
|
||||
rtsps_sessions_rtp_packets_jitter 0
|
||||
rtsps_sessions_rtcp_packets_received 0
|
||||
rtsps_sessions_rtcp_packets_sent 0
|
||||
rtsps_sessions_rtcp_packets_in_error 0
|
||||
rtmp_conns 0
|
||||
rtmp_conns_bytes_received 0
|
||||
rtmp_conns_bytes_sent 0
|
||||
@@ -96,8 +112,57 @@ rtmps_conns 0
|
||||
rtmps_conns_bytes_received 0
|
||||
rtmps_conns_bytes_sent 0
|
||||
srt_conns 0
|
||||
srt_conns_bytes_received 0
|
||||
srt_conns_packets_sent 0
|
||||
srt_conns_packets_received 0
|
||||
srt_conns_packets_sent_unique 0
|
||||
srt_conns_packets_received_unique 0
|
||||
srt_conns_packets_send_loss 0
|
||||
srt_conns_packets_received_loss 0
|
||||
srt_conns_packets_retrans 0
|
||||
srt_conns_packets_received_retrans 0
|
||||
srt_conns_packets_sent_ack 0
|
||||
srt_conns_packets_received_ack 0
|
||||
srt_conns_packets_sent_nak 0
|
||||
srt_conns_packets_received_nak 0
|
||||
srt_conns_packets_sent_km 0
|
||||
srt_conns_packets_received_km 0
|
||||
srt_conns_us_snd_duration 0
|
||||
srt_conns_packets_send_drop 0
|
||||
srt_conns_packets_received_drop 0
|
||||
srt_conns_packets_received_undecrypt 0
|
||||
srt_conns_bytes_sent 0
|
||||
srt_conns_bytes_received 0
|
||||
srt_conns_bytes_sent_unique 0
|
||||
srt_conns_bytes_received_unique 0
|
||||
srt_conns_bytes_received_loss 0
|
||||
srt_conns_bytes_retrans 0
|
||||
srt_conns_bytes_received_retrans 0
|
||||
srt_conns_bytes_send_drop 0
|
||||
srt_conns_bytes_received_drop 0
|
||||
srt_conns_bytes_received_undecrypt 0
|
||||
srt_conns_us_packets_send_period 0
|
||||
srt_conns_packets_flow_window 0
|
||||
srt_conns_packets_flight_size 0
|
||||
srt_conns_ms_rtt 0
|
||||
srt_conns_mbps_send_rate 0
|
||||
srt_conns_mbps_receive_rate 0
|
||||
srt_conns_mbps_link_capacity 0
|
||||
srt_conns_bytes_avail_send_buf 0
|
||||
srt_conns_bytes_avail_receive_buf 0
|
||||
srt_conns_mbps_max_bw 0
|
||||
srt_conns_bytes_mss 0
|
||||
srt_conns_packets_send_buf 0
|
||||
srt_conns_bytes_send_buf 0
|
||||
srt_conns_ms_send_buf 0
|
||||
srt_conns_ms_send_tsb_pd_delay 0
|
||||
srt_conns_packets_receive_buf 0
|
||||
srt_conns_bytes_receive_buf 0
|
||||
srt_conns_ms_receive_buf 0
|
||||
srt_conns_ms_receive_tsb_pd_delay 0
|
||||
srt_conns_packets_reorder_tolerance 0
|
||||
srt_conns_packets_received_avg_belated_time 0
|
||||
srt_conns_packets_send_loss_rate 0
|
||||
srt_conns_packets_received_loss_rate 0
|
||||
webrtc_sessions 0
|
||||
webrtc_sessions_bytes_received 0
|
||||
webrtc_sessions_bytes_sent 0
|
||||
@@ -281,12 +346,28 @@ webrtc_sessions_bytes_sent 0
|
||||
`rtsp_sessions\{id=".*?",state="publish"\} 1`+"\n"+
|
||||
`rtsp_sessions_bytes_received\{id=".*?",state="publish"\} 0`+"\n"+
|
||||
`rtsp_sessions_bytes_sent\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsp_sessions_rtp_packets_received\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsp_sessions_rtp_packets_sent\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsp_sessions_rtp_packets_lost\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsp_sessions_rtp_packets_in_error\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsp_sessions_rtp_packets_jitter\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsp_sessions_rtcp_packets_received\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsp_sessions_rtcp_packets_sent\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsp_sessions_rtcp_packets_in_error\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsps_conns\{id=".*?"\} 1`+"\n"+
|
||||
`rtsps_conns_bytes_received\{id=".*?"\} [0-9]+`+"\n"+
|
||||
`rtsps_conns_bytes_sent\{id=".*?"\} [0-9]+`+"\n"+
|
||||
`rtsps_sessions\{id=".*?",state="publish"\} 1`+"\n"+
|
||||
`rtsps_sessions_bytes_received\{id=".*?",state="publish"\} 0`+"\n"+
|
||||
`rtsps_sessions_bytes_sent\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsps_sessions_rtp_packets_received\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsps_sessions_rtp_packets_sent\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsps_sessions_rtp_packets_lost\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsps_sessions_rtp_packets_in_error\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsps_sessions_rtp_packets_jitter\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsps_sessions_rtcp_packets_received\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsps_sessions_rtcp_packets_sent\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtsps_sessions_rtcp_packets_in_error\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtmp_conns\{id=".*?",state="publish"\} 1`+"\n"+
|
||||
`rtmp_conns_bytes_received\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
`rtmp_conns_bytes_sent\{id=".*?",state="publish"\} [0-9]+`+"\n"+
|
||||
|
@@ -118,15 +118,23 @@ const (
|
||||
|
||||
// APIRTSPSession is a RTSP session.
|
||||
type APIRTSPSession struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Created time.Time `json:"created"`
|
||||
RemoteAddr string `json:"remoteAddr"`
|
||||
State APIRTSPSessionState `json:"state"`
|
||||
Path string `json:"path"`
|
||||
Query string `json:"query"`
|
||||
Transport *string `json:"transport"`
|
||||
BytesReceived uint64 `json:"bytesReceived"`
|
||||
BytesSent uint64 `json:"bytesSent"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
Created time.Time `json:"created"`
|
||||
RemoteAddr string `json:"remoteAddr"`
|
||||
State APIRTSPSessionState `json:"state"`
|
||||
Path string `json:"path"`
|
||||
Query string `json:"query"`
|
||||
Transport *string `json:"transport"`
|
||||
BytesReceived uint64 `json:"bytesReceived"`
|
||||
BytesSent uint64 `json:"bytesSent"`
|
||||
RTPPacketsReceived uint64 `json:"rtpPacketsReceived"`
|
||||
RTPPacketsSent uint64 `json:"rtpPacketsSent"`
|
||||
RTPPacketsLost uint64 `json:"rtpPacketsLost"`
|
||||
RTPPacketsInError uint64 `json:"rtpPacketsInError"`
|
||||
RTPPacketsJitter float64 `json:"rtpPacketsJitter"`
|
||||
RTCPPacketsReceived uint64 `json:"rtcpPacketsReceived"`
|
||||
RTCPPacketsSent uint64 `json:"rtcpPacketsSent"`
|
||||
RTCPPacketsInError uint64 `json:"rtcpPacketsInError"`
|
||||
}
|
||||
|
||||
// APIRTSPSessionList is a list of RTSP sessions.
|
||||
|
@@ -203,11 +203,27 @@ func (m *Metrics) onMetrics(ctx *gin.Context) {
|
||||
out += metric("rtsp_sessions", tags, 1)
|
||||
out += metric("rtsp_sessions_bytes_received", tags, int64(i.BytesReceived))
|
||||
out += metric("rtsp_sessions_bytes_sent", tags, int64(i.BytesSent))
|
||||
out += metric("rtsp_sessions_rtp_packets_received", tags, int64(i.RTPPacketsReceived))
|
||||
out += metric("rtsp_sessions_rtp_packets_sent", tags, int64(i.RTPPacketsSent))
|
||||
out += metric("rtsp_sessions_rtp_packets_lost", tags, int64(i.RTPPacketsLost))
|
||||
out += metric("rtsp_sessions_rtp_packets_in_error", tags, int64(i.RTPPacketsInError))
|
||||
out += metricFloat("rtsp_sessions_rtp_packets_jitter", tags, i.RTPPacketsJitter)
|
||||
out += metric("rtsp_sessions_rtcp_packets_received", tags, int64(i.RTCPPacketsReceived))
|
||||
out += metric("rtsp_sessions_rtcp_packets_sent", tags, int64(i.RTCPPacketsSent))
|
||||
out += metric("rtsp_sessions_rtcp_packets_in_error", tags, int64(i.RTCPPacketsInError))
|
||||
}
|
||||
} else {
|
||||
out += metric("rtsp_sessions", "", 0)
|
||||
out += metric("rtsp_sessions_bytes_received", "", 0)
|
||||
out += metric("rtsp_sessions_bytes_sent", "", 0)
|
||||
out += metric("rtsp_sessions_rtp_packets_received", "", 0)
|
||||
out += metric("rtsp_sessions_rtp_packets_sent", "", 0)
|
||||
out += metric("rtsp_sessions_rtp_packets_lost", "", 0)
|
||||
out += metric("rtsp_sessions_rtp_packets_in_error", "", 0)
|
||||
out += metricFloat("rtsp_sessions_rtp_packets_jitter", "", 0)
|
||||
out += metric("rtsp_sessions_rtcp_packets_received", "", 0)
|
||||
out += metric("rtsp_sessions_rtcp_packets_sent", "", 0)
|
||||
out += metric("rtsp_sessions_rtcp_packets_in_error", "", 0)
|
||||
}
|
||||
}()
|
||||
}
|
||||
@@ -237,11 +253,27 @@ func (m *Metrics) onMetrics(ctx *gin.Context) {
|
||||
out += metric("rtsps_sessions", tags, 1)
|
||||
out += metric("rtsps_sessions_bytes_received", tags, int64(i.BytesReceived))
|
||||
out += metric("rtsps_sessions_bytes_sent", tags, int64(i.BytesSent))
|
||||
out += metric("rtsps_sessions_rtp_packets_received", tags, int64(i.RTPPacketsReceived))
|
||||
out += metric("rtsps_sessions_rtp_packets_sent", tags, int64(i.RTPPacketsSent))
|
||||
out += metric("rtsps_sessions_rtp_packets_lost", tags, int64(i.RTPPacketsLost))
|
||||
out += metric("rtsps_sessions_rtp_packets_in_error", tags, int64(i.RTPPacketsInError))
|
||||
out += metricFloat("rtsps_sessions_rtp_packets_jitter", tags, i.RTPPacketsJitter)
|
||||
out += metric("rtsps_sessions_rtcp_packets_received", tags, int64(i.RTCPPacketsReceived))
|
||||
out += metric("rtsps_sessions_rtcp_packets_sent", tags, int64(i.RTCPPacketsSent))
|
||||
out += metric("rtsps_sessions_rtcp_packets_in_error", tags, int64(i.RTCPPacketsInError))
|
||||
}
|
||||
} else {
|
||||
out += metric("rtsps_sessions", "", 0)
|
||||
out += metric("rtsps_sessions_bytes_received", "", 0)
|
||||
out += metric("rtsps_sessions_bytes_sent", "", 0)
|
||||
out += metric("rtsps_sessions_rtp_packets_received", "", 0)
|
||||
out += metric("rtsps_sessions_rtp_packets_sent", "", 0)
|
||||
out += metric("rtsps_sessions_rtp_packets_lost", "", 0)
|
||||
out += metric("rtsps_sessions_rtp_packets_in_error", "", 0)
|
||||
out += metricFloat("rtsps_sessions_rtp_packets_jitter", "", 0)
|
||||
out += metric("rtsps_sessions_rtcp_packets_received", "", 0)
|
||||
out += metric("rtsps_sessions_rtcp_packets_sent", "", 0)
|
||||
out += metric("rtsps_sessions_rtcp_packets_in_error", "", 0)
|
||||
}
|
||||
}()
|
||||
}
|
||||
@@ -338,8 +370,57 @@ func (m *Metrics) onMetrics(ctx *gin.Context) {
|
||||
}
|
||||
} else {
|
||||
out += metric("srt_conns", "", 0)
|
||||
out += metric("srt_conns_bytes_received", "", 0)
|
||||
out += metric("srt_conns_packets_sent", "", 0)
|
||||
out += metric("srt_conns_packets_received", "", 0)
|
||||
out += metric("srt_conns_packets_sent_unique", "", 0)
|
||||
out += metric("srt_conns_packets_received_unique", "", 0)
|
||||
out += metric("srt_conns_packets_send_loss", "", 0)
|
||||
out += metric("srt_conns_packets_received_loss", "", 0)
|
||||
out += metric("srt_conns_packets_retrans", "", 0)
|
||||
out += metric("srt_conns_packets_received_retrans", "", 0)
|
||||
out += metric("srt_conns_packets_sent_ack", "", 0)
|
||||
out += metric("srt_conns_packets_received_ack", "", 0)
|
||||
out += metric("srt_conns_packets_sent_nak", "", 0)
|
||||
out += metric("srt_conns_packets_received_nak", "", 0)
|
||||
out += metric("srt_conns_packets_sent_km", "", 0)
|
||||
out += metric("srt_conns_packets_received_km", "", 0)
|
||||
out += metric("srt_conns_us_snd_duration", "", 0)
|
||||
out += metric("srt_conns_packets_send_drop", "", 0)
|
||||
out += metric("srt_conns_packets_received_drop", "", 0)
|
||||
out += metric("srt_conns_packets_received_undecrypt", "", 0)
|
||||
out += metric("srt_conns_bytes_sent", "", 0)
|
||||
out += metric("srt_conns_bytes_received", "", 0)
|
||||
out += metric("srt_conns_bytes_sent_unique", "", 0)
|
||||
out += metric("srt_conns_bytes_received_unique", "", 0)
|
||||
out += metric("srt_conns_bytes_received_loss", "", 0)
|
||||
out += metric("srt_conns_bytes_retrans", "", 0)
|
||||
out += metric("srt_conns_bytes_received_retrans", "", 0)
|
||||
out += metric("srt_conns_bytes_send_drop", "", 0)
|
||||
out += metric("srt_conns_bytes_received_drop", "", 0)
|
||||
out += metric("srt_conns_bytes_received_undecrypt", "", 0)
|
||||
out += metricFloat("srt_conns_us_packets_send_period", "", 0)
|
||||
out += metric("srt_conns_packets_flow_window", "", 0)
|
||||
out += metric("srt_conns_packets_flight_size", "", 0)
|
||||
out += metricFloat("srt_conns_ms_rtt", "", 0)
|
||||
out += metricFloat("srt_conns_mbps_send_rate", "", 0)
|
||||
out += metricFloat("srt_conns_mbps_receive_rate", "", 0)
|
||||
out += metricFloat("srt_conns_mbps_link_capacity", "", 0)
|
||||
out += metric("srt_conns_bytes_avail_send_buf", "", 0)
|
||||
out += metric("srt_conns_bytes_avail_receive_buf", "", 0)
|
||||
out += metricFloat("srt_conns_mbps_max_bw", "", 0)
|
||||
out += metric("srt_conns_bytes_mss", "", 0)
|
||||
out += metric("srt_conns_packets_send_buf", "", 0)
|
||||
out += metric("srt_conns_bytes_send_buf", "", 0)
|
||||
out += metric("srt_conns_ms_send_buf", "", 0)
|
||||
out += metric("srt_conns_ms_send_tsb_pd_delay", "", 0)
|
||||
out += metric("srt_conns_packets_receive_buf", "", 0)
|
||||
out += metric("srt_conns_bytes_receive_buf", "", 0)
|
||||
out += metric("srt_conns_ms_receive_buf", "", 0)
|
||||
out += metric("srt_conns_ms_receive_tsb_pd_delay", "", 0)
|
||||
out += metric("srt_conns_packets_reorder_tolerance", "", 0)
|
||||
out += metric("srt_conns_packets_received_avg_belated_time", "", 0)
|
||||
out += metricFloat("srt_conns_packets_send_loss_rate", "", 0)
|
||||
out += metricFloat("srt_conns_packets_received_loss_rate", "", 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -205,11 +205,16 @@ func (c *conn) handleAuthError(authErr error) (*base.Response, error) {
|
||||
}
|
||||
|
||||
func (c *conn) apiItem() *defs.APIRTSPConn {
|
||||
stats := c.rconn.Stats()
|
||||
if stats == nil {
|
||||
stats = &gortsplib.StatsConn{}
|
||||
}
|
||||
|
||||
return &defs.APIRTSPConn{
|
||||
ID: c.uuid,
|
||||
Created: c.created,
|
||||
RemoteAddr: c.remoteAddr().String(),
|
||||
BytesReceived: c.rconn.BytesReceived(),
|
||||
BytesSent: c.rconn.BytesSent(),
|
||||
BytesReceived: stats.BytesReceived,
|
||||
BytesSent: stats.BytesSent,
|
||||
}
|
||||
}
|
||||
|
@@ -372,6 +372,11 @@ func (s *session) apiItem() *defs.APIRTSPSession {
|
||||
s.mutex.Lock()
|
||||
defer s.mutex.Unlock()
|
||||
|
||||
stats := s.rsession.Stats()
|
||||
if stats == nil {
|
||||
stats = &gortsplib.StatsSession{}
|
||||
}
|
||||
|
||||
return &defs.APIRTSPSession{
|
||||
ID: s.uuid,
|
||||
Created: s.created,
|
||||
@@ -397,7 +402,15 @@ func (s *session) apiItem() *defs.APIRTSPSession {
|
||||
v := s.transport.String()
|
||||
return &v
|
||||
}(),
|
||||
BytesReceived: s.rsession.BytesReceived(),
|
||||
BytesSent: s.rsession.BytesSent(),
|
||||
BytesReceived: stats.BytesReceived,
|
||||
BytesSent: stats.BytesSent,
|
||||
RTPPacketsReceived: stats.RTPPacketsReceived,
|
||||
RTPPacketsSent: stats.RTPPacketsSent,
|
||||
RTPPacketsLost: stats.RTPPacketsLost,
|
||||
RTPPacketsInError: stats.RTPPacketsInError,
|
||||
RTPPacketsJitter: stats.RTPPacketsJitter,
|
||||
RTCPPacketsReceived: stats.RTCPPacketsReceived,
|
||||
RTCPPacketsSent: stats.RTCPPacketsSent,
|
||||
RTCPPacketsInError: stats.RTCPPacketsInError,
|
||||
}
|
||||
}
|
||||
|
@@ -97,10 +97,16 @@ func (s *Stream) BytesSent() uint64 {
|
||||
|
||||
bytesSent := atomic.LoadUint64(s.bytesSent)
|
||||
if s.rtspStream != nil {
|
||||
bytesSent += s.rtspStream.BytesSent()
|
||||
stats := s.rtspStream.Stats()
|
||||
if stats != nil {
|
||||
bytesSent += stats.BytesSent
|
||||
}
|
||||
}
|
||||
if s.rtspsStream != nil {
|
||||
bytesSent += s.rtspsStream.BytesSent()
|
||||
stats := s.rtspsStream.Stats()
|
||||
if stats != nil {
|
||||
bytesSent += stats.BytesSent
|
||||
}
|
||||
}
|
||||
return bytesSent
|
||||
}
|
||||
|
Reference in New Issue
Block a user