show RemoteAddr in server trace

This commit is contained in:
iamqizhao
2015-10-01 17:43:05 -07:00
parent a15e3b9562
commit 2bd5f5b1e1
3 changed files with 8 additions and 0 deletions

View File

@ -291,6 +291,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
traceInfo.tr = trace.New("grpc.Recv."+methodFamily(stream.Method()), stream.Method())
defer traceInfo.tr.Finish()
traceInfo.firstLine.client = false
traceInfo.firstLine.remoteAddr = t.RemoteAddr()
traceInfo.tr.LazyLog(&traceInfo.firstLine, false)
ctx = trace.NewContext(ctx, traceInfo.tr)
defer func() {
@ -397,6 +398,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
if ss.tracing {
ss.traceInfo.tr = trace.New("grpc.Recv."+methodFamily(stream.Method()), stream.Method())
ss.traceInfo.firstLine.client = false
ss.traceInfo.firstLine.remoteAddr = t.RemoteAddr()
ss.traceInfo.tr.LazyLog(&ss.traceInfo.firstLine, false)
ss.ctx = trace.NewContext(ss.ctx, ss.traceInfo.tr)
defer func() {