Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project brave-instrumentation-dubbo miss fresh spanId and parentSpanId in Dubbo 2.7 #1454

Open
xiaoduanayu opened this issue Mar 4, 2025 · 1 comment
Labels

Comments

@xiaoduanayu
Copy link

Describe the Bug

I have three dubbo project, to make it simple, their names are A, B and C. A is a consumer, B is both a provider and a consumer, and C is a provider, so the call chain is like this:
A-->B-->C

when I start a request, it pass through the whole chain, after finishing the request, I find the trace info in last project(i.e. project C) is error, the following trace info indicates the error:
A
kind CLIENT: traceId:70d0 spanId:9340 parentId:70d0
B
kind SERVER: traceId:70d0 spanId:9340 parentId:70d0
kind CLIENT: traceId:70d0 spanId:4211 parentId:9340
C
kind SERVER: traceId:70d0 spanId:9340 parentId:70d0

there is an obvious error in this trace info, the info of C kind SERVER should be spanId:4211 parentId:9340

The cause of the Bug

Perhaps this code in org.apache.dubbo.rpc.protocol.AbstractInvoker line 160 causes the error, the code context as follows:

        Map<String, Object> contextAttachments = RpcContext.getContext().getObjectAttachments();
        if (CollectionUtils.isNotEmptyMap(contextAttachments)) {
            invocation.addObjectAttachments(contextAttachments);
        }

this code indicates that before B makes an invocation to C, trace info in Invocation object is fresh, but it is old in RpcContext, and this code replace fresh trace info with old one! so the error happens.

@xiaoduanayu xiaoduanayu added the bug label Mar 4, 2025
@jiangjunjieabc
Copy link

你跟我的问题好像一样,我也是升级dubbo版本导致的,不过我这边定位的问题是在TracingFilter ,这里他尝试去将traceId传递过去,但是并没有传递成功,他设置到了dubboClientRequest,但是没设置到invocation中去。导致生产者无法读取

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants