diff --git a/cas/sectigocas/eab/client.go b/cas/sectigocas/eab/client.go index d93e04603..ce5b9f14c 100644 --- a/cas/sectigocas/eab/client.go +++ b/cas/sectigocas/eab/client.go @@ -34,11 +34,10 @@ func MustFromContext(ctx context.Context) pb.EABServiceClient { func Connect(host string) (pb.EABServiceClient, error) { - conn, err := grpc.DialContext( - context.Background(), + conn, err := grpc.NewClient( host, grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()), + grpc.WithStatsHandler(otelgrpc.NewClientHandler()), ) if err != nil { return nil, err diff --git a/cas/sectigocas/sectigocas.go b/cas/sectigocas/sectigocas.go index e7530e376..d77c8f3cf 100644 --- a/cas/sectigocas/sectigocas.go +++ b/cas/sectigocas/sectigocas.go @@ -6,7 +6,6 @@ import ( "encoding/json" "encoding/pem" "fmt" - "time" "github.com/smallstep/certificates/acme" "github.com/smallstep/certificates/acme/api" @@ -38,26 +37,20 @@ func New(ctx context.Context, opts apiv1.Options) (*SectigoCAS, error) { if err != nil { return nil, err } - ctx, cancel := context.WithTimeout(ctx, 3*time.Second) - defer cancel() - conn, err := grpc.DialContext( - ctx, + conn, err := grpc.NewClient( config.PKIBackend, - grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()), + grpc.WithStatsHandler(otelgrpc.NewClientHandler()), ) if err != nil { return nil, err } sslServiceClient := pb.NewSSLServiceClient(conn) - conn, err = grpc.DialContext( - ctx, + conn, err = grpc.NewClient( config.EABBackend, - grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()), + grpc.WithStatsHandler(otelgrpc.NewClientHandler()), ) if err != nil { return nil, err