feat: 完善服务监控与下游重投

This commit is contained in:
hectorzhao
2026-08-14 17:21:29 +08:00
parent d30d9ea4d0
commit 1ef4380422
50 changed files with 1279 additions and 82 deletions
+7
View File
@@ -201,6 +201,13 @@ func onlineAccounts() []string {
return accounts
}
// ActiveConnectionCount exposes only an aggregate gauge; account and remote-IP labels are intentionally excluded.
func ActiveConnectionCount() int {
downstreamRegistry.RLock()
defer downstreamRegistry.RUnlock()
return len(downstreamRegistry.byConn)
}
// DisconnectAccount closes every live downstream CMPP session for an
// application account. The normal connection-close callback removes registry
// and presence state and reports the disconnect to the API.