Merge branch 'master' of https://github.com/grpc/grpc-go
This commit is contained in:
5
call.go
5
call.go
@ -133,7 +133,6 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
callHdr := &transport.CallHdr{
|
callHdr := &transport.CallHdr{
|
||||||
Host: cc.authority,
|
Host: cc.authority,
|
||||||
Method: method,
|
Method: method,
|
||||||
@ -165,7 +164,7 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli
|
|||||||
return toRPCErr(err)
|
return toRPCErr(err)
|
||||||
}
|
}
|
||||||
if EnableTracing {
|
if EnableTracing {
|
||||||
c.traceInfo.tr.LazyLog(payload{args}, true)
|
c.traceInfo.tr.LazyLog(&payload{sent: true, msg: args}, true)
|
||||||
}
|
}
|
||||||
stream, err = sendRequest(ctx, cc.dopts.codec, callHdr, t, args, topts)
|
stream, err = sendRequest(ctx, cc.dopts.codec, callHdr, t, args, topts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -184,7 +183,7 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if EnableTracing {
|
if EnableTracing {
|
||||||
c.traceInfo.tr.LazyLog(payload{reply}, true)
|
c.traceInfo.tr.LazyLog(&payload{sent: false, msg: reply}, true)
|
||||||
}
|
}
|
||||||
t.CloseStream(stream, lastErr)
|
t.CloseStream(stream, lastErr)
|
||||||
if lastErr != nil {
|
if lastErr != nil {
|
||||||
|
@ -166,7 +166,7 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) {
|
|||||||
if cs.tracing {
|
if cs.tracing {
|
||||||
cs.mu.Lock()
|
cs.mu.Lock()
|
||||||
if cs.traceInfo.tr != nil {
|
if cs.traceInfo.tr != nil {
|
||||||
cs.traceInfo.tr.LazyLog(payload{m}, true)
|
cs.traceInfo.tr.LazyLog(&payload{sent: true, msg: m}, true)
|
||||||
}
|
}
|
||||||
cs.mu.Unlock()
|
cs.mu.Unlock()
|
||||||
}
|
}
|
||||||
@ -195,6 +195,13 @@ func (cs *clientStream) RecvMsg(m interface{}) (err error) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
if cs.tracing {
|
||||||
|
cs.mu.Lock()
|
||||||
|
if cs.traceInfo.tr != nil {
|
||||||
|
cs.traceInfo.tr.LazyLog(&payload{sent: false, msg: m}, true)
|
||||||
|
}
|
||||||
|
cs.mu.Unlock()
|
||||||
|
}
|
||||||
if !cs.desc.ClientStreams || cs.desc.ServerStreams {
|
if !cs.desc.ClientStreams || cs.desc.ServerStreams {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
9
trace.go
9
trace.go
@ -93,12 +93,17 @@ func (f *firstLine) String() string {
|
|||||||
|
|
||||||
// payload represents an RPC request or response payload.
|
// payload represents an RPC request or response payload.
|
||||||
type payload struct {
|
type payload struct {
|
||||||
m interface{} // e.g. a proto.Message
|
sent bool // whether this is an outgoing payload
|
||||||
|
msg interface{} // e.g. a proto.Message
|
||||||
// TODO(dsymonds): add stringifying info to codec, and limit how much we hold here?
|
// TODO(dsymonds): add stringifying info to codec, and limit how much we hold here?
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p payload) String() string {
|
func (p payload) String() string {
|
||||||
return fmt.Sprint(p.m)
|
if p.sent {
|
||||||
|
return fmt.Sprintf("sent: %v", p.msg)
|
||||||
|
} else {
|
||||||
|
return fmt.Sprintf("recv: %v", p.msg)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type fmtStringer struct {
|
type fmtStringer struct {
|
||||||
|
Reference in New Issue
Block a user