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

Rpc-client getExt() 和 Rpc-serve getExtKey() 不匹配 #1303

Closed
JoeXiong opened this issue May 29, 2020 · 0 comments
Closed

Rpc-client getExt() 和 Rpc-serve getExtKey() 不匹配 #1303

JoeXiong opened this issue May 29, 2020 · 0 comments

Comments

@JoeXiong
Copy link

/vendor/swoft/rpc-client/src/Extender.php

   /**
     * @return array
     */
    public function getExt(): array
    {
        return [
            context()->get('traceid', ''),
            context()->get('spanid', ''),
            context()->get('parentid', ''),
            context()->get('extra', null),
        ];
    }

/vendor/swoft/rpc-server/src/Listener/BeforeReceiveListener.

        if (Log::getLogger()->isEnable()) {

            $uri = sprintf('%s::%s::%s', $request->getVersion(), $request->getInterface(), $request->getMethod());

            $data = [
                'traceid'     => $request->getExtKey('traceid', ''),
                'spanid'      => $request->getExtKey('spanid', ''),
                'parentid'    => $request->getExtKey('parentid', ''),
                'uri'         => $uri,
                'requestTime' => $request->getRequestTime(),
            ];

            $serviceContext->setMulti($data);
        }

rpc-client getExt的时候获取ext数组是索引数组,key值是0,1,2,3...
而rpc-server getExtKey的时候是直接通过traceid去获取的,是获取不到值的
建议rpc-client getExt的时候直接返回关联数组

@inhere inhere self-assigned this May 29, 2020
@inhere inhere added this to the v2.0.10 milestone May 29, 2020
inhere added a commit to swoft-cloud/swoft-rpc-client that referenced this issue Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants