mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 19:49:57 +00:00
TUN-8441: Correct UDP total sessions metric to a counter and add new ICMP metrics
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.
This commit is contained in:
39
ingress/icmp_metrics.go
Normal file
39
ingress/icmp_metrics.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package ingress
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
namespace = "cloudflared"
|
||||
)
|
||||
|
||||
var (
|
||||
icmpRequests = prometheus.NewCounter(prometheus.CounterOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: "icmp",
|
||||
Name: "total_requests",
|
||||
Help: "Total count of ICMP requests that have been proxied to any origin",
|
||||
})
|
||||
icmpReplies = prometheus.NewCounter(prometheus.CounterOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: "icmp",
|
||||
Name: "total_replies",
|
||||
Help: "Total count of ICMP replies that have been proxied from any origin",
|
||||
})
|
||||
)
|
||||
|
||||
func init() {
|
||||
prometheus.MustRegister(
|
||||
icmpRequests,
|
||||
icmpReplies,
|
||||
)
|
||||
}
|
||||
|
||||
func incrementICMPRequest() {
|
||||
icmpRequests.Inc()
|
||||
}
|
||||
|
||||
func incrementICMPReply() {
|
||||
icmpReplies.Inc()
|
||||
}
|
Reference in New Issue
Block a user