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:
Devin Carr
2023-06-16 17:07:56 -07:00
parent 20e36c5bf3
commit a3bcf25fae
4 changed files with 73 additions and 2 deletions

View File

@@ -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()
}
}