metrics: Prometheus endpoint on its own --metrics listener; the pod exposes it inside the cluster only

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-19 10:56:43 +01:00
co-authored by Claude Sonnet 5.5
parent b922808a51
commit c653ae4206
13 changed files with 306 additions and 3 deletions
+10 -1
View File
@@ -29,6 +29,10 @@ type ipGate struct {
counts map[string]int
banned atomic.Pointer[func(peer.ID) bool]
// Totals since the start, for the metrics.
refusedFull atomic.Uint64 // connections refused: the source address was full
refusedBanned atomic.Uint64 // connections refused: the peer is banned
}
func newIPGate(max int) *ipGate { return &ipGate{max: max, counts: map[string]int{}} }
@@ -72,11 +76,16 @@ func (g *ipGate) full(a ma.Multiaddr) bool {
func (g *ipGate) InterceptPeerDial(peer.ID) bool { return true }
func (g *ipGate) InterceptAddrDial(peer.ID, ma.Multiaddr) bool { return true }
func (g *ipGate) InterceptAccept(cm network.ConnMultiaddrs) bool {
return !g.full(cm.RemoteMultiaddr())
if g.full(cm.RemoteMultiaddr()) {
g.refusedFull.Add(1)
return false
}
return true
}
func (g *ipGate) InterceptSecured(dir network.Direction, p peer.ID, _ network.ConnMultiaddrs) bool {
if dir == network.DirInbound {
if f := g.banned.Load(); f != nil && (*f)(p) {
g.refusedBanned.Add(1)
return false
}
}