feat(webrtc): add StreamCount() for metrics snapshot
This commit is contained in:
parent
15af16ce97
commit
1d7cd5b520
1 changed files with 9 additions and 2 deletions
|
|
@ -12,8 +12,7 @@ import (
|
|||
|
||||
// Subsystem is the app-level WebRTC egress manager. It sits alongside
|
||||
// api.API as a sibling — both consume the Restream service, both wire
|
||||
// themselves into the Echo HTTP router. The subsystem is responsible
|
||||
// for:
|
||||
// themselves into the Echo HTTP router. The subsystem is responsible for:
|
||||
//
|
||||
// - Translating the global config.DataWebRTC into the core-level
|
||||
// corewebrtc.Config used by the PeerFactory.
|
||||
|
|
@ -129,6 +128,14 @@ func (s *Subsystem) SetTeardownHook(fn func(streamID string)) {
|
|||
s.teardown = fn
|
||||
}
|
||||
|
||||
// StreamCount returns the number of processes currently registered with
|
||||
// active WebRTC egress. Used by the Prometheus snapshot collector.
|
||||
func (s *Subsystem) StreamCount() int {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return len(s.streams)
|
||||
}
|
||||
|
||||
// lookup returns the per-process stream pair for id, or nil, false.
|
||||
// Used by the WHEP handler.
|
||||
func (s *Subsystem) lookup(id string) (*processStream, bool) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue