Skip to content

Commit

Permalink
Merge pull request #496 from brotherlogic/capture_fanout_failure
Browse files Browse the repository at this point in the history
capture_fanout_failure
  • Loading branch information
brotherlogic committed Aug 15, 2020
2 parents cdbcd3f + 077a23e commit 00a9d1a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions discovery.go
Expand Up @@ -473,6 +473,13 @@ func (s *Server) Shutdown(ctx context.Context) error {
return nil
}

var (
fanout = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "discovery_fanout",
Help: "The size of the print queue",
}, []string{"service", "origin", "error"})
)

func (s *Server) fanoutRegister(ctx context.Context, req *pb.RegisterRequest) {
for _, f := range s.friends {
conn, err := s.FDial(f)
Expand All @@ -482,9 +489,11 @@ func (s *Server) fanoutRegister(ctx context.Context, req *pb.RegisterRequest) {
_, err := client.RegisterV2(ctx, req)
if err != nil {
s.Log(fmt.Sprintf("register error: %v", err))
fanout.With(prometheus.Labels{"service": req.GetService().GetName(), "origin": f, "error": fmt.Sprintf("%v", err)}).Inc()
}
} else {
s.Log(fmt.Sprintf("Dial error in fanout register: %v", err))
fanout.With(prometheus.Labels{"service": req.GetService().GetName(), "origin": f, "error": fmt.Sprintf("%v", err)}).Inc()
}
}
}
Expand Down

0 comments on commit 00a9d1a

Please sign in to comment.