icmp_metrics.go 752 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package ingress
  2. import (
  3. "github.com/prometheus/client_golang/prometheus"
  4. )
  5. const (
  6. namespace = "cloudflared"
  7. )
  8. var (
  9. icmpRequests = prometheus.NewCounter(prometheus.CounterOpts{
  10. Namespace: namespace,
  11. Subsystem: "icmp",
  12. Name: "total_requests",
  13. Help: "Total count of ICMP requests that have been proxied to any origin",
  14. })
  15. icmpReplies = prometheus.NewCounter(prometheus.CounterOpts{
  16. Namespace: namespace,
  17. Subsystem: "icmp",
  18. Name: "total_replies",
  19. Help: "Total count of ICMP replies that have been proxied from any origin",
  20. })
  21. )
  22. func init() {
  23. prometheus.MustRegister(
  24. icmpRequests,
  25. icmpReplies,
  26. )
  27. }
  28. func incrementICMPRequest() {
  29. icmpRequests.Inc()
  30. }
  31. func incrementICMPReply() {
  32. icmpReplies.Inc()
  33. }