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

fix heartbeat miss filling hostname #1277

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

liangry
Copy link
Collaborator

@liangry liangry commented Dec 21, 2023

  1. agent should report hostname to config server
  2. uuid is not helpful to identify agent. ip, pid and time is enough

     2. uuid is not helpful to identify agent. ip, pid and time is enough
@@ -1312,7 +1312,7 @@ ConfigManagerBase::ConfigManagerBase() {
CorrectionLogtailSysConfDir(); // first create dir then rewrite system-uuid file in GetSystemUUID
// use a thread to get uuid, work around for CalculateDmiUUID hang
// mUUID = CalculateDmiUUID();
mInstanceId = CalculateRandomUUID() + "_" + LogFileProfiler::mIpAddr + "_" + ToString(time(NULL));
mInstanceId = LogFileProfiler::mIpAddr + "_" + ToString(getpid()) + "_" + ToString(time(NULL));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不太建议改,pid可能复用,多租环境下也不能确保ip+pid的唯一性

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在是IP+PID+时间戳,有其它更好方案吗?UUID真是百无一用

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

也不能这么说,uuid就是uuid,你不能说一个id就是没用的,他的作用就是保持唯一性。如果是一些重要信息的的encode或者signature那么肯定会更好。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

它不仅是一个 ID,还是一个数据库主键,我们采集集群已经拥有超过四位数的 Agent 了,使用 UUID 作为主键会有明显的负作用,我相信绝大多数情况下 IP+PID+时间戳足够了,要是真的有特殊情况不接受,起码也应该让用户有选择权去决定 Agent 的主键选择

1. since mInstanceId is already applied, use a new member mAgentId instead
2. in practise, ip + time + pid is better than ip + pid + time
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

Successfully merging this pull request may close these issues.

None yet

2 participants