Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2021-04-07 11:36:51 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2021-04-07 14:31:22 +0300
commitb6667cd49a3c9b804d419531fc65180d8d15514b (patch)
treee3c841e892e10d3234fdd5b14c4696e1df1996bb
parent3e05485c631886f48b6ddc914fadaaf0edc94b76 (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.go13
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(),
+ )
+}