diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2021-04-07 11:36:51 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2021-04-07 14:31:22 +0300 |
commit | b6667cd49a3c9b804d419531fc65180d8d15514b (patch) | |
tree | e3c841e892e10d3234fdd5b14c4696e1df1996bb | |
parent | 3e05485c631886f48b6ddc914fadaaf0edc94b76 (diff) |
Export client UnaryInterceptors
This commits exports a function that returns the unary interceptors
that should be configured for a client so they can be used in other
dialing code as well.
-rw-r--r-- | internal/gitaly/client/dial.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/internal/gitaly/client/dial.go b/internal/gitaly/client/dial.go index 5705d9d14..5b6fe226d 100644 --- a/internal/gitaly/client/dial.go +++ b/internal/gitaly/client/dial.go @@ -127,10 +127,7 @@ func Dial(ctx context.Context, rawAddress string, connOpts []grpc.DialOption, ha Time: 20 * time.Second, PermitWithoutStream: true, }), - grpc.WithChainUnaryInterceptor( - grpctracing.UnaryClientTracingInterceptor(), - grpccorrelation.UnaryClientCorrelationInterceptor(), - ), + UnaryInterceptor(), grpc.WithChainStreamInterceptor( grpctracing.StreamClientTracingInterceptor(), grpccorrelation.StreamClientCorrelationInterceptor(), @@ -144,3 +141,11 @@ func Dial(ctx context.Context, rawAddress string, connOpts []grpc.DialOption, ha return conn, nil } + +// UnaryInterceptor returns the unary interceptors that should be configured for a client. +func UnaryInterceptor() grpc.DialOption { + return grpc.WithChainUnaryInterceptor( + grpctracing.UnaryClientTracingInterceptor(), + grpccorrelation.UnaryClientCorrelationInterceptor(), + ) +} |