feat: 完善服务监控与下游重投
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user