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
+15
View File
@@ -146,6 +146,21 @@ func (m *Manager) ensureDefaultsLocked() {
}
}
// ConnectionCounts returns bounded platform totals without channel identifiers to prevent time-series cardinality growth.
func (m *Manager) ConnectionCounts() (desired int, connected int) {
m.mu.Lock()
pools := make([]*connectionPool, 0, len(m.conns))
for _, pool := range m.conns {
pools = append(pools, pool)
}
m.mu.Unlock()
for _, pool := range pools {
desired += max(pool.config.DesiredConnections, 1)
connected += pool.countActiveConnections()
}
return desired, connected
}
func (m *Manager) newConnectionPool(channelID string, connectionID string, config queue.UpstreamConfig) *connectionPool {
return &connectionPool{
channelID: channelID,