func (h *ThriftHandler) firstCall(ctx context.Context, req *TracingRequest) (*TracingResponse, error) { tctx := thrift.Wrap(ctx) res, err := h.thriftClient.Call(tctx, requestToThrift(req)) if err != nil { return nil, err } return responseFromThrift(h.t, res) }
func (h *thriftHandler) callDownstream(ctx context.Context, target *Downstream) (*Response, error) { req := &Request{ ServerRole: target.ServerRole, Downstream: target.Downstream, } opts := &thrift.ClientOptions{HostPort: target.HostPort} thriftClient := thrift.NewClient(h.ch, target.ServiceName, opts) serviceClient := gen.NewTChanSimpleServiceClient(thriftClient) tReq, err := requestToThrift(req) if err != nil { return nil, err } log.Printf("Calling Thrift service %s (%s)", target.ServiceName, target.HostPort) tctx := thrift.Wrap(ctx) res, err := serviceClient.Call(tctx, tReq) if err != nil { return nil, err } return responseFromThrift(res) }