transport/grpc: use "pick_first" as child policy For DirectPath, we need to specify the service config to use "pick_first" as the child policy for grpclb, so when channel pool is used (which is necessary for CloudPath), the client won't create too many sub connections. Change-Id: I2ea8c544a15bd516c4deffb436f129130bbfe2fc Reviewed-on: https://code-review.googlesource.com/c/google-api-go-client/+/50575 Reviewed-by: Chris Broadfoot <cbro@google.com>
diff --git a/transport/grpc/dial.go b/transport/grpc/dial.go index 1d2c9df..adad182 100644 --- a/transport/grpc/dial.go +++ b/transport/grpc/dial.go
@@ -135,6 +135,11 @@ grpc.WithCredentialsBundle( grpcgoogle.NewComputeEngineCredentials(), ), + // For now all DirectPath go clients will be using the following lb config, but in future + // when different services need different configs, then we should change this to a + // per-service config. + grpc.WithDisableServiceConfig(), + grpc.WithDefaultServiceConfig(`{"loadBalancingConfig":[{"grpclb":{"childPolicy":[{"pick_first":{}}]}}]}`), } // TODO(cbro): add support for system parameters (quota project, request reason) via chained interceptor. } else {