-
Notifications
You must be signed in to change notification settings - Fork 719
Description
if (kind.equals(Kind.CLIENT)) {
// When A service invoke B service, then B service then invoke C service, the parentId of the
// C service span is A when read from invocation.getAttachments(). This is because
// AbstractInvoker adds attachments via RpcContext.getContext(), not the invocation.
// See org.apache.dubbo.rpc.protocol.AbstractInvoker(line 141) from v2.7.3
Map<String, String> attachments = RpcContext.getContext().getAttachments();
DubboClientRequest clientRequest = new DubboClientRequest(invoker, invocation, attachments);
request = clientRequest;
span = clientHandler.handleSendWithParent(clientRequest, invocationContext);
} else {
DubboServerRequest serverRequest = new DubboServerRequest(invoker, invocation);
request = serverRequest;
span = serverHandler.handleReceive(serverRequest);
}
boolean isSynchronous = true;
Scope scope = currentTraceContext.newScope(span.context());
Result result = null;
Throwable error = null;
try {
result = invoker.invoke(invocation);
当我执行到这里,我在生产者那边无法获取到【traceId】 或者 【spanId】,我打断点后发现,invocation的attachments并不包含这些内容(B3),如果我在这里为invocation设置attachments,生产者那边就可以正常读取,否则不能