Do not automatically inject client traces

This is a effective revert of 294143bf38
The one thing that makes it not a total revert is this keeps the usage
of chain interceptors, which prevents us from overwriting interceptors
passed into client options.

The automatic trace injection is unnecessary overhead since callers of
this function can add the necessary interceptors when creating the
client.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff
2022-01-13 21:58:57 +00:00
parent 140ecc9247
commit d5e8edf2df
2 changed files with 3 additions and 19 deletions

View File

@@ -61,7 +61,6 @@ import (
ptypes "github.com/gogo/protobuf/types"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"golang.org/x/sync/semaphore"
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"
@@ -136,16 +135,10 @@ func New(address string, opts ...ClientOpt) (*Client, error) {
}
if copts.defaultns != "" {
unary, stream := newNSInterceptors(copts.defaultns)
gopts = append(gopts,
grpc.WithChainUnaryInterceptor(unary, otelgrpc.UnaryClientInterceptor()),
grpc.WithChainStreamInterceptor(stream, otelgrpc.StreamClientInterceptor()),
)
} else {
gopts = append(gopts,
grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()),
grpc.WithStreamInterceptor(otelgrpc.StreamClientInterceptor()),
)
gopts = append(gopts, grpc.WithChainUnaryInterceptor(unary))
gopts = append(gopts, grpc.WithChainStreamInterceptor(stream))
}
connector := func() (*grpc.ClientConn, error) {
ctx, cancel := context.WithTimeout(context.Background(), copts.timeout)
defer cancel()