TUN-1732: cloudflared metrics should track userHostnames
This commit is contained in:
parent
2bef5dbe72
commit
2e2fa29637
|
@ -55,8 +55,9 @@ type TunnelMetrics struct {
|
||||||
regFail *prometheus.CounterVec
|
regFail *prometheus.CounterVec
|
||||||
rpcFail *prometheus.CounterVec
|
rpcFail *prometheus.CounterVec
|
||||||
|
|
||||||
muxerMetrics *muxerMetrics
|
muxerMetrics *muxerMetrics
|
||||||
tunnelsHA tunnelsForHA
|
tunnelsHA tunnelsForHA
|
||||||
|
userHostnamesCounts *prometheus.CounterVec
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMuxerMetrics() *muxerMetrics {
|
func newMuxerMetrics() *muxerMetrics {
|
||||||
|
@ -364,6 +365,15 @@ func NewTunnelMetrics() *TunnelMetrics {
|
||||||
)
|
)
|
||||||
prometheus.MustRegister(registerFail)
|
prometheus.MustRegister(registerFail)
|
||||||
|
|
||||||
|
userHostnamesCounts := prometheus.NewCounterVec(
|
||||||
|
prometheus.CounterOpts{
|
||||||
|
Name: "user_hostnames_counts",
|
||||||
|
Help: "Which user hostnames cloudflared is serving",
|
||||||
|
},
|
||||||
|
[]string{"userHostname"},
|
||||||
|
)
|
||||||
|
prometheus.MustRegister(userHostnamesCounts)
|
||||||
|
|
||||||
registerSuccess := prometheus.NewCounter(
|
registerSuccess := prometheus.NewCounter(
|
||||||
prometheus.CounterOpts{
|
prometheus.CounterOpts{
|
||||||
Name: "tunnel_register_success",
|
Name: "tunnel_register_success",
|
||||||
|
@ -389,6 +399,7 @@ func NewTunnelMetrics() *TunnelMetrics {
|
||||||
regSuccess: registerSuccess,
|
regSuccess: registerSuccess,
|
||||||
regFail: registerFail,
|
regFail: registerFail,
|
||||||
rpcFail: rpcFail,
|
rpcFail: rpcFail,
|
||||||
|
userHostnamesCounts: userHostnamesCounts,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -396,6 +396,8 @@ func RegisterTunnel(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.Metrics.userHostnamesCounts.WithLabelValues(registration.Url).Inc()
|
||||||
|
|
||||||
config.Logger.Infof("Route propagating, it may take up to 1 minute for your new route to become functional")
|
config.Logger.Infof("Route propagating, it may take up to 1 minute for your new route to become functional")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue