Include load in stats response.

This commit is contained in:
Joachim Bauch 2020-10-15 13:27:08 +02:00
parent 7d690d049f
commit 644d9a1737
Failed to extract signature
2 changed files with 7 additions and 0 deletions

View file

@ -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

View file

@ -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"`
}
@ -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()