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

调用链路的唯一ID #121

Open
city-invoker opened this issue Mar 17, 2024 · 1 comment
Open

调用链路的唯一ID #121

city-invoker opened this issue Mar 17, 2024 · 1 comment

Comments

@city-invoker
Copy link

/// @brief Get the unique id of the current request.
uint32_t GetRequestId() const { return invoke_info_.seq_id; }

这个seq_id是调用的唯一ID么,这里看到框架是通过请求的request_id设置的,而且只是一个uint32_t, 这里怎么保证seq_id是全局唯一的呢
context->SetRequestId(req->req_header.request_id());

这里应该 是使用一个uuid,或用雪花算法类的ID吧

@helloopenworld
Copy link
Contributor

这里seq_id的唯一性是指具体某个连接上请求的唯一性,局部的唯一性,如果想在当前服务节点上,得到请求的唯一性,可以通过conn_id(连接id)+请求seq_id,如果是要得到全局请求的唯一,就需要类似上面所说的uuid或雪花算法来得到了。

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

No branches or pull requests

2 participants