Add soju_upstream_connect_errors_total metric
This commit is contained in:
parent
d11216917b
commit
8acc07d591
@ -106,6 +106,8 @@ type Server struct {
|
||||
upstreamInMessagesTotal prometheus.Counter
|
||||
downstreamOutMessagesTotal prometheus.Counter
|
||||
downstreamInMessagesTotal prometheus.Counter
|
||||
|
||||
upstreamConnectErrorsTotal prometheus.Counter
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,6 +197,11 @@ func (s *Server) registerMetrics() {
|
||||
Name: "soju_downstream_in_messages_total",
|
||||
Help: "Total number of incoming messages received from downstream clients",
|
||||
})
|
||||
|
||||
s.metrics.upstreamConnectErrorsTotal = factory.NewCounter(prometheus.CounterOpts{
|
||||
Name: "soju_upstream_connect_errors_total",
|
||||
Help: "Total number of upstream connection errors",
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) Shutdown() {
|
||||
|
2
user.go
2
user.go
@ -209,6 +209,7 @@ func (net *network) run() {
|
||||
net.logger.Printf("failed to connect to upstream server %q: %v", net.Addr, err)
|
||||
net.user.events <- eventUpstreamConnectionError{net, fmt.Errorf("failed to connect: %v", err)}
|
||||
net.user.srv.metrics.upstreams.Add(-1)
|
||||
net.user.srv.metrics.upstreamConnectErrorsTotal.Inc()
|
||||
continue
|
||||
}
|
||||
|
||||
@ -226,6 +227,7 @@ func (net *network) run() {
|
||||
net.user.events <- eventUpstreamConnectionError{net, fmt.Errorf("failed to register: %v", text)}
|
||||
uc.Close()
|
||||
net.user.srv.metrics.upstreams.Add(-1)
|
||||
net.user.srv.metrics.upstreamConnectErrorsTotal.Inc()
|
||||
continue
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user