[#12] tracing: Add gRPC middleware

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-03-17 15:54:33 +03:00
parent 816628d37d
commit 488ee50f9e
3 changed files with 305 additions and 0 deletions

View file

@ -1,6 +1,7 @@
package client
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/pkg/tracing"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
)
@ -24,5 +25,14 @@ func New(opts ...Option) *Client {
c.grpcDialOpts = append(c.grpcDialOpts, grpc.WithTransportCredentials(credentials.NewTLS(c.tlsCfg)))
}
c.grpcDialOpts = append(c.grpcDialOpts,
grpc.WithChainUnaryInterceptor(
tracing.NewGRPCUnaryClientInteceptor(),
),
grpc.WithChainStreamInterceptor(
tracing.NewGRPCStreamClientInterceptor(),
),
)
return &c
}