Skip to content

Commit

Permalink
xds: add temporary logging to LRS (#3490)
Browse files Browse the repository at this point in the history
  • Loading branch information
menghanl committed Apr 2, 2020
1 parent 508cf42 commit fe1d8e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 8 additions & 6 deletions xds/internal/balancer/lrs/lrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ func (ls *lrsStore) ReportTo(ctx context.Context, cc *grpc.ClientConn, clusterNa
grpclog.Warningf("lrs: failed to create stream: %v", err)
continue
}
if err := stream.Send(&lrspb.LoadStatsRequest{
Node: node,
}); err != nil {
grpclog.Infof("lrs: created LRS stream")
req := &lrspb.LoadStatsRequest{Node: node}
grpclog.Infof("lrs: sending init LoadStatsRequest: %v", req)
if err := stream.Send(req); err != nil {
grpclog.Warningf("lrs: failed to send first request: %v", err)
continue
}
Expand All @@ -324,6 +325,7 @@ func (ls *lrsStore) ReportTo(ctx context.Context, cc *grpc.ClientConn, clusterNa
grpclog.Warningf("lrs: failed to receive first response: %v", err)
continue
}
grpclog.Infof("lrs: received first LoadStatsResponse: %+v", first)
interval, err := ptypes.Duration(first.LoadReportingInterval)
if err != nil {
grpclog.Warningf("lrs: failed to convert report interval: %v", err)
Expand Down Expand Up @@ -366,9 +368,9 @@ func (ls *lrsStore) sendLoads(ctx context.Context, stream lrsgrpc.LoadReportingS
case <-ctx.Done():
return
}
if err := stream.Send(&lrspb.LoadStatsRequest{
ClusterStats: ls.buildStats(clusterName),
}); err != nil {
req := &lrspb.LoadStatsRequest{ClusterStats: ls.buildStats(clusterName)}
grpclog.Infof("lrs: sending LRS loads: %+v", req)
if err := stream.Send(req); err != nil {
grpclog.Warningf("lrs: failed to send report: %v", err)
return
}
Expand Down
2 changes: 2 additions & 0 deletions xds/internal/client/client_loadreport.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ func (c *Client) ReportLoad(server string, clusterName string, loadStore lrs.Sto
cc *grpc.ClientConn
closeCC bool
)
c.logger.Infof("Starting load report to server: %s", server)
if server == "" || server == c.opts.Config.BalancerName {
cc = c.cc
} else {
c.logger.Infof("LRS server is different from xDS server, starting a new ClientConn")
dopts := append([]grpc.DialOption{c.opts.Config.Creds}, c.opts.DialOpts...)
ccNew, err := grpc.Dial(server, dopts...)
if err != nil {
Expand Down

0 comments on commit fe1d8e7

Please sign in to comment.