mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2025-06-27 07:58:50 +02:00
Store connected viewers in Prometheus and serve this amount
This commit is contained in:
@ -2,6 +2,7 @@ package webrtc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gitlab.crans.org/nounous/ghostream/internal/monitoring"
|
||||
"io"
|
||||
"log"
|
||||
"math/rand"
|
||||
@ -128,10 +129,12 @@ func newPeerHandler(remoteSdp webrtc.SessionDescription, cfg *Options) webrtc.Se
|
||||
// Register tracks
|
||||
videoTracks = append(videoTracks, videoTrack)
|
||||
audioTracks = append(audioTracks, audioTrack)
|
||||
monitoring.WebRTCConnectedSessions.Inc()
|
||||
} else if connectionState == webrtc.ICEConnectionStateDisconnected {
|
||||
// Unregister tracks
|
||||
videoTracks = removeTrack(videoTracks, videoTrack)
|
||||
audioTracks = removeTrack(audioTracks, audioTrack)
|
||||
monitoring.WebRTCConnectedSessions.Dec()
|
||||
}
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user