mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 04:42:33 +02:00

- fixed "API JWT secret empty" warning output format - fixed metrics initialized when it should not - fixed middlewares.modifyRequest Host header not working properly
26 lines
712 B
Go
26 lines
712 B
Go
package metrics
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/yusing/go-proxy/internal/common"
|
|
)
|
|
|
|
func InitRouterMetrics(getRPsCount func() int, getStreamsCount func() int) {
|
|
if !common.PrometheusEnabled {
|
|
return
|
|
}
|
|
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())
|
|
}))
|
|
}
|