add response trace log for client streaming
This commit is contained in:
Родитель
dc36cdbfdd
Коммит
0252e09f21
4
call.go
4
call.go
|
@ -165,7 +165,7 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli
|
|||
return toRPCErr(err)
|
||||
}
|
||||
if EnableTracing {
|
||||
c.traceInfo.tr.LazyLog(payload{args}, true)
|
||||
c.traceInfo.tr.LazyLog(&fmtStringer{"sent: %v", []interface{}{payload{args}}}, true)
|
||||
}
|
||||
stream, err = sendRequest(ctx, cc.dopts.codec, callHdr, t, args, topts)
|
||||
if err != nil {
|
||||
|
@ -184,7 +184,7 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli
|
|||
continue
|
||||
}
|
||||
if EnableTracing {
|
||||
c.traceInfo.tr.LazyLog(payload{reply}, true)
|
||||
c.traceInfo.tr.LazyLog(&fmtStringer{"received: %v", []interface{}{payload{reply}}}, true)
|
||||
}
|
||||
t.CloseStream(stream, lastErr)
|
||||
if lastErr != nil {
|
||||
|
|
|
@ -166,7 +166,7 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) {
|
|||
if cs.tracing {
|
||||
cs.mu.Lock()
|
||||
if cs.traceInfo.tr != nil {
|
||||
cs.traceInfo.tr.LazyLog(payload{m}, true)
|
||||
cs.traceInfo.tr.LazyLog(&fmtStringer{"sent: %v", []interface{}{payload{m}}}, true)
|
||||
}
|
||||
cs.mu.Unlock()
|
||||
}
|
||||
|
@ -187,6 +187,13 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) {
|
|||
}
|
||||
|
||||
func (cs *clientStream) RecvMsg(m interface{}) (err error) {
|
||||
if cs.tracing {
|
||||
cs.mu.Lock()
|
||||
if cs.traceInfo.tr != nil {
|
||||
cs.traceInfo.tr.LazyLog(&fmtStringer{"received: %v", []interface{}{payload{m}}}, true)
|
||||
}
|
||||
cs.mu.Unlock()
|
||||
}
|
||||
err = recv(cs.p, cs.codec, m)
|
||||
defer func() {
|
||||
// err != nil indicates the termination of the stream.
|
||||
|
|
Загрузка…
Ссылка в новой задаче