TUN-1732: cloudflared metrics should track userHostnames

This commit is contained in:
Adam Chalmers 2019-04-16 15:26:31 -05:00
parent 2bef5dbe72
commit 2e2fa29637
2 changed files with 15 additions and 2 deletions

View File

@ -57,6 +57,7 @@ type TunnelMetrics struct {
muxerMetrics *muxerMetrics
tunnelsHA tunnelsForHA
userHostnamesCounts *prometheus.CounterVec
}
func newMuxerMetrics() *muxerMetrics {
@ -364,6 +365,15 @@ func NewTunnelMetrics() *TunnelMetrics {
)
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(
prometheus.CounterOpts{
Name: "tunnel_register_success",
@ -389,6 +399,7 @@ func NewTunnelMetrics() *TunnelMetrics {
regSuccess: registerSuccess,
regFail: registerFail,
rpcFail: rpcFail,
userHostnamesCounts: userHostnamesCounts,
}
}

View File

@ -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")
return nil
}