Skip to content

Commit 649a210

Browse files
committed
Allow any registered gRPC load balancer to be used
1 parent 3dad181 commit 649a210

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

config/configgrpc/configgrpc.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
1818
"go.opentelemetry.io/otel"
1919
"google.golang.org/grpc"
20-
"google.golang.org/grpc/balancer/roundrobin"
20+
"google.golang.org/grpc/balancer"
2121
"google.golang.org/grpc/credentials"
2222
"google.golang.org/grpc/credentials/insecure"
2323
"google.golang.org/grpc/encoding/gzip"
@@ -38,9 +38,6 @@ import (
3838

3939
var errMetadataNotFound = errors.New("no request metadata found")
4040

41-
// Allowed balancer names to be set in grpclb_policy to discover the servers.
42-
var allowedBalancerNames = []string{roundrobin.Name, grpc.PickFirstBalancerName}
43-
4441
// KeepaliveClientConfig exposes the keepalive.ClientParameters to be used by the exporter.
4542
// Refer to the original data-structure for the meaning of each parameter:
4643
// https://godoc.org/google.golang.org/grpc/keepalive#ClientParameters
@@ -269,12 +266,7 @@ func (gcs *GRPCClientSettings) toDialOptions(host component.Host, settings compo
269266
}
270267

271268
func validateBalancerName(balancerName string) bool {
272-
for _, item := range allowedBalancerNames {
273-
if item == balancerName {
274-
return true
275-
}
276-
}
277-
return false
269+
return balancer.Get(balancerName) != nil
278270
}
279271

280272
// ToListener returns the net.Listener constructed from the settings.

0 commit comments

Comments
 (0)