mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 22:49:58 +00:00
TUN-7477: Add UDP/TCP session metrics
New gauge metrics are exposed in the prometheus endpoint to capture the current and total TCP and UDP sessions that cloudflared has proxied.
This commit is contained in:
@@ -118,6 +118,7 @@ func (m *manager) registerSession(ctx context.Context, registration *registerSes
|
||||
session := m.newSession(registration.sessionID, registration.originProxy)
|
||||
m.sessions[registration.sessionID] = session
|
||||
registration.resultChan <- session
|
||||
incrementUDPSessions()
|
||||
}
|
||||
|
||||
func (m *manager) newSession(id uuid.UUID, dstConn io.ReadWriteCloser) *Session {
|
||||
@@ -163,6 +164,7 @@ func (m *manager) unregisterSession(unregistration *unregisterSessionEvent) {
|
||||
if ok {
|
||||
delete(m.sessions, unregistration.sessionID)
|
||||
session.close(unregistration.err)
|
||||
decrementUDPActiveSessions()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user