mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-05-22 11:36:35 +00:00

cloudflared_udp_total_sessions was incorrectly a gauge when it represents the total since the cloudflared process started and will only ever increase. Additionally adds new ICMP metrics for requests and replies.
41 lines
821 B
Go
41 lines
821 B
Go
package datagramsession
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
const (
|
|
namespace = "cloudflared"
|
|
)
|
|
|
|
var (
|
|
activeUDPSessions = prometheus.NewGauge(prometheus.GaugeOpts{
|
|
Namespace: namespace,
|
|
Subsystem: "udp",
|
|
Name: "active_sessions",
|
|
Help: "Concurrent count of UDP sessions that are being proxied to any origin",
|
|
})
|
|
totalUDPSessions = prometheus.NewCounter(prometheus.CounterOpts{
|
|
Namespace: namespace,
|
|
Subsystem: "udp",
|
|
Name: "total_sessions",
|
|
Help: "Total count of UDP sessions that have been proxied to any origin",
|
|
})
|
|
)
|
|
|
|
func init() {
|
|
prometheus.MustRegister(
|
|
activeUDPSessions,
|
|
totalUDPSessions,
|
|
)
|
|
}
|
|
|
|
func incrementUDPSessions() {
|
|
totalUDPSessions.Inc()
|
|
activeUDPSessions.Inc()
|
|
}
|
|
|
|
func decrementUDPActiveSessions() {
|
|
activeUDPSessions.Dec()
|
|
}
|