Skip to content

Commit

Permalink
Include load in stats response.
Browse files Browse the repository at this point in the history
  • Loading branch information
fancycode committed Oct 15, 2020
1 parent 7d690d0 commit 644d9a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/proxy/proxy_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,7 @@ func (s *ProxyServer) GetClientId(client signaling.McuClient) string {
func (s *ProxyServer) getStats() map[string]interface{} {
result := map[string]interface{}{
"sessions": s.GetSessionsCount(),
"load": atomic.LoadInt64(&s.load),
"mcu": s.mcu.GetStats(),
}
return result
Expand Down
6 changes: 6 additions & 0 deletions src/signaling/mcu_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ type mcuProxyConnectionStats struct {
Connected bool `json:"connected"`
Publishers int64 `json:"publishers"`
Clients int64 `json:"clients"`
Load *int64 `json:"load,omitempty"`
Shutdown *bool `json:"shutdown,omitempty"`
Uptime *time.Time `json:"uptime,omitempty"`
}

Expand All @@ -328,6 +330,10 @@ func (c *mcuProxyConnection) GetStats() *mcuProxyConnectionStats {
if c.conn != nil {
result.Connected = true
result.Uptime = &c.connectedSince
load := c.Load()
result.Load = &load
shutdown := c.IsShutdownScheduled()
result.Shutdown = &shutdown
}
c.mu.Unlock()
c.publishersLock.RLock()
Expand Down

0 comments on commit 644d9a1

Please sign in to comment.