mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 20:52:33 +02:00
20 lines
617 B
Go
20 lines
617 B
Go
package metrics
|
|
|
|
import "github.com/prometheus/client_golang/prometheus"
|
|
|
|
func InitRouterMetrics(getRPsCount func() int, getStreamsCount func() int) {
|
|
prometheus.MustRegister(prometheus.NewGaugeFunc(prometheus.GaugeOpts{
|
|
Namespace: "entrypoint",
|
|
Name: "num_reverse_proxies",
|
|
Help: "The number of reverse proxies",
|
|
}, func() float64 {
|
|
return float64(getRPsCount())
|
|
}))
|
|
prometheus.MustRegister(prometheus.NewGaugeFunc(prometheus.GaugeOpts{
|
|
Namespace: "entrypoint",
|
|
Name: "num_streams",
|
|
Help: "The number of streams",
|
|
}, func() float64 {
|
|
return float64(getStreamsCount())
|
|
}))
|
|
}
|