Skip to content

Commit bf6de53

Browse files
committed
Fix missing remoteAddress in Dubbo plugin
1 parent 01b84ce commit bf6de53

File tree

1 file changed

+6
-1
lines changed
  • instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7

1 file changed

+6
-1
lines changed

instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboRequest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@ public abstract class DubboRequest {
1818
static DubboRequest create(RpcInvocation invocation, RpcContext context) {
1919
// In dubbo 3 RpcContext delegates to a ThreadLocal context. We copy the url and remote address
2020
// here to ensure we can access them from the thread that ends the span.
21+
22+
// There is a compatibility issue with context.getRemoteAddress() in 3.x.
23+
// In some versions, context.getRemoteAddress() may return null.
24+
// Use context.getUrl().toInetSocketAddress() here directly, related bugfix PR:
25+
// https://github.com/apache/dubbo/issues/11790
2126
return new AutoValue_DubboRequest(
2227
invocation,
2328
context,
2429
context.getUrl(),
25-
context.getRemoteAddress(),
30+
context.getUrl().toInetSocketAddress(),
2631
context.getLocalAddress());
2732
}
2833

0 commit comments

Comments
 (0)