From 677e74ad3ea7814324097fec077d401ea09e6928 Mon Sep 17 00:00:00 2001 From: Benjamin Staffin Date: Wed, 13 Feb 2019 00:07:32 -0500 Subject: [PATCH] Use roundRobin balancing even if only one hostname (#1329) If you run jaeger-agent with `--reporter.grpc.host-port dns:///jaeger-collector-hostname:14250` (note the `dns:///` part!), the GRPC client resolves the given hostname to one or more IPs and can load balance among the backend addresses it finds. It even looks up and obeys SRV records, if they exist. This change makes jaeger-agent use round-robin load balancing in that situation, rather than the default of `pick_first`. If there is only one backend, or the user doesn't explicitly put `dns:///` before the hostname, this will have no effect. Signed-off-by: Benjamin Staffin --- cmd/agent/app/reporter/grpc/collector_proxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/agent/app/reporter/grpc/collector_proxy.go b/cmd/agent/app/reporter/grpc/collector_proxy.go index 1e60d5eb8e7a..9cfe69648f41 100644 --- a/cmd/agent/app/reporter/grpc/collector_proxy.go +++ b/cmd/agent/app/reporter/grpc/collector_proxy.go @@ -52,7 +52,7 @@ func NewCollectorProxy(o *Options, mFactory metrics.Factory, logger *zap.Logger) conn, _ = grpc.Dial(r.Scheme()+":///round_robin", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name)) } else { // It does not return error if the collector is not running - conn, _ = grpc.Dial(o.CollectorHostPort[0], grpc.WithInsecure()) + conn, _ = grpc.Dial(o.CollectorHostPort[0], grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name)) } grpcMetrics := mFactory.Namespace(metrics.NSOptions{Name: "", Tags: map[string]string{"protocol": "grpc"}}) return &ProxyBuilder{