Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pkg/rpc/nodedialer/nodedialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ func (n *Dialer) DialInternalClient(
if err != nil {
return nil, err
}
return TracingInternalClient{InternalClient: kvpb.NewInternalClient(conn)}, nil
client := kvpb.NewInternalClient(conn)
client = maybeWrapInTracingClient(ctx, client)
return client, nil
}

// dial performs the dialing of the remote connection. If checkBreaker
Expand Down Expand Up @@ -282,8 +284,16 @@ type TracingInternalClient struct {
kvpb.InternalClient
}

func maybeWrapInTracingClient(ctx context.Context, client kvpb.InternalClient) kvpb.InternalClient {
sp := tracing.SpanFromContext(ctx)
if sp != nil && !sp.IsNoop() {
client = &TracingInternalClient{InternalClient: client}
}
return client
}

// Batch overrides the Batch RPC client method and fills in tracing information.
func (tic TracingInternalClient) Batch(
func (tic *TracingInternalClient) Batch(
ctx context.Context, ba *kvpb.BatchRequest, opts ...grpc.CallOption,
) (*kvpb.BatchResponse, error) {
sp := tracing.SpanFromContext(ctx)
Expand Down