Skip to content

Commit

Permalink
httpgrpc/server: Update NewClient to not use WithBalancerName
Browse files Browse the repository at this point in the history
On projects consuming this module as a library, gRPC might be set at
newer versions where the deprecated #WithBalancerName has been removed
already. Given that the version used by this module already offers a
forward-compatible method, this commit uses that instead of the
deprecated #WithBalancerName.

This is a simplified version of #240, without touching the gRPC versions.

Fixes #239

Signed-off-by: Juraci Paixão Kröhling <[email protected]>
  • Loading branch information
jpkrohling committed Sep 1, 2022
1 parent 54029b5 commit 9f7a500
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions httpgrpc/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/sercand/kuberesolver"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/balancer/roundrobin"

"github.com/weaveworks/common/httpgrpc"
"github.com/weaveworks/common/logging"
Expand Down Expand Up @@ -132,9 +131,10 @@ func NewClient(address string) (*Client, error) {
if err != nil {
return nil, err
}
const grpcServiceConfig = `{"loadBalancingPolicy":"round_robin"}`

dialOptions := []grpc.DialOption{
grpc.WithBalancerName(roundrobin.Name),
grpc.WithDefaultServiceConfig(grpcServiceConfig),
grpc.WithInsecure(),
grpc.WithUnaryInterceptor(grpc_middleware.ChainUnaryClient(
otgrpc.OpenTracingClientInterceptor(opentracing.GlobalTracer()),
Expand Down

0 comments on commit 9f7a500

Please sign in to comment.