Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ type TransportOptions struct {
RoutingKey string `long:"rk" description:"The routing key overrides the service name traffic group for proxies."`
RoutingDelegate string `long:"rd" description:"The routing delegate overrides the routing key traffic group for proxies."`
ShardKey string `long:"sk" description:"The shard key is a transport header that clues where to send a request within a clustered traffic group."`
RPCEncoding string `long:"rpc-encoding" description:"Override the RPC-Encoding header value for gRPC and HTTP transports. This does not affect the actual encoding, only the header value, and it's intended to be used for development."`
Jaeger bool `long:"jaeger" description:"Use the Jaeger tracing client to send Uber style traces and baggage headers"`
TransportHeaders map[string]string `short:"T" long:"topt" description:"Transport options for TChannel, protocol headers for HTTP"`
HTTPMethod string `long:"http-method" description:"The HTTP method to use"`
Expand Down
12 changes: 10 additions & 2 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,25 +164,33 @@ func getTransport(opts TransportOptions, resolved resolvedProtocolEncoding, trac
}

if resolved.protocol == transport.GRPC {
grpcEncoding := resolved.enc.String()
if opts.RPCEncoding != "" {
grpcEncoding = opts.RPCEncoding
}
return transport.NewGRPC(transport.GRPCOptions{
Addresses: getHosts(opts.Peers),
Tracer: tracer,
Caller: opts.CallerName,
Encoding: resolved.enc.String(),
Encoding: grpcEncoding,
RoutingKey: opts.RoutingKey,
RoutingDelegate: opts.RoutingDelegate,
MaxResponseSize: opts.GRPCMaxResponseSize,
})
}

httpEncoding := resolved.enc.String()
if opts.RPCEncoding != "" {
httpEncoding = opts.RPCEncoding
}
hopts := transport.HTTPOptions{
Method: opts.HTTPMethod,
SourceService: opts.CallerName,
TargetService: opts.ServiceName,
RoutingDelegate: opts.RoutingDelegate,
RoutingKey: opts.RoutingKey,
ShardKey: opts.ShardKey,
Encoding: resolved.enc.String(),
Encoding: httpEncoding,
URLs: opts.Peers,
Tracer: tracer,
UseHTTP2: opts.UseHTTP2,
Expand Down