mirror of https://github.com/grpc/grpc-go.git
xds: add temporary logging to LRS (#3490)
This commit is contained in:
parent
508cf42036
commit
fe1d8e7181
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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)
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue