Skip to content

Commit 1b2bcc6

Browse files
authored
Adding support for custom grpc dial options in Go SDK (#1043)
1 parent d779567 commit 1b2bcc6

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

sdk/go/client.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"crypto/x509"
66
"fmt"
7+
78
"github.com/feast-dev/feast/sdk/go/protos/feast/serving"
89
"github.com/opentracing/opentracing-go"
910
"go.opencensus.io/plugin/ocgrpc"
@@ -43,16 +44,25 @@ func NewGrpcClient(host string, port int) (*GrpcClient, error) {
4344
})
4445
}
4546

46-
// NewAuthGrpcClient constructs a secure client that uses security features (ie authentication).
47+
// NewSecureGrpcClient constructs a secure client that uses security features (ie authentication).
4748
// host - hostname of the serving host/instance to connect to.
4849
// port - post of the host to service host/instancf to connect to.
4950
// securityConfig - security config configures client security.
5051
func NewSecureGrpcClient(host string, port int, security SecurityConfig) (*GrpcClient, error) {
52+
return NewSecureGrpcClientWithDialOptions(host, port, security)
53+
}
54+
55+
// NewSecureGrpcClientWithDialOptions constructs a secure client that uses security features (ie authentication) along with custom grpc dial options.
56+
// host - hostname of the serving host/instance to connect to.
57+
// port - post of the host to service host/instancf to connect to.
58+
// securityConfig - security config configures client security.
59+
// opts - grpc.DialOptions which should be used with this connection
60+
func NewSecureGrpcClientWithDialOptions(host string, port int, security SecurityConfig, opts ...grpc.DialOption) (*GrpcClient, error) {
5161
feastCli := &GrpcClient{}
5262
adr := fmt.Sprintf("%s:%d", host, port)
5363

5464
// Compile grpc dial options from security config.
55-
options := []grpc.DialOption{grpc.WithStatsHandler(&ocgrpc.ClientHandler{})}
65+
options := append(opts, grpc.WithStatsHandler(&ocgrpc.ClientHandler{}))
5666
// Configure client TLS.
5767
if !security.EnableTLS {
5868
options = append(options, grpc.WithInsecure())

0 commit comments

Comments
 (0)