Conversation
📝 WalkthroughWalkthroughThe remote IP extraction logic in TripleTracerAdapter's serverReceived method now retrieves the raw IP address instead of the host name from InetSocketAddress objects, using Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/tracer/sofatracer/TripleTracerAdapter.java (1)
309-314: PotentialNullPointerExceptionifgetAddress()returns null.The change from
getHostName()togetAddress().getHostAddress()is a good improvement to avoid DNS reverse lookups. However,InetSocketAddress.getAddress()can returnnullfor unresolved addresses, which would cause an NPE.🛡️ Suggested defensive null check
String remoteIp = ""; SocketAddress socketAddress = call.getAttributes().get( Grpc.TRANSPORT_ATTR_REMOTE_ADDR); - if (socketAddress instanceof InetSocketAddress) { - remoteIp = ((InetSocketAddress) socketAddress).getAddress().getHostAddress(); + if (socketAddress instanceof InetSocketAddress) { + InetAddress inetAddress = ((InetSocketAddress) socketAddress).getAddress(); + if (inetAddress != null) { + remoteIp = inetAddress.getHostAddress(); + } }
enhance remote ip get logic
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.