-
Notifications
You must be signed in to change notification settings - Fork 407
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
feat: support host monitor #1890
base: main
Are you sure you want to change the base?
Conversation
6150e52
to
bfdd9c2
Compare
4110e3d
to
3e12438
Compare
ThreadPool mThreadPool; | ||
|
||
mutable std::shared_mutex mRegisteredCollectorMapMutex; | ||
std::unordered_map<std::string, bool> mRegisteredCollectorMap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::unordered_map<std::string, bool> mRegisteredCollectorMap;
std::unordered_map<std::string, std::shared_ptr<BaseCollector>> mCollectorInstanceMap;
这两个变量有点不合理。
包括
1、HostMonitorInputRunner::GetCollector的使用上。应该是自闭环合法性
2、锁的关系等
3、RegisterCollector 操作的变量是 mCollectorInstanceMap,但是另一个没操作的变量却叫reg
可能的优化
1、保持现有逻辑。一组功能不用过多发散变量,以上改成一个map。value用结构体表示。整体实现结构优化下。
2、UpdateCollector时再注册ProcessEntityCollector实例,这样能省一个变量。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
const std::string ProcessEntityCollector::sName = "process_entity"; | ||
|
||
ProcessEntityCollector::ProcessEntityCollector() : mProcessSilentCount(INT32_FLAG(process_collect_silent_count)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 线程池放入不会堵塞,runner拿到任务后,可以立刻放入线程池
- 在一个任务执行结束后,再放入下一个任务。一个任务超时,会计算从上一次执行时间开始,增加n个周期,到达下一个未来可执行的时间点。
nextExecTime = execTime + n * interval
core/constants/EntityConstants.cpp
Outdated
// process entity | ||
const std::string DEFAULT_CONTENT_VALUE_ENTITY_TYPE_ECS_PROCESS = "acs.ecs.process"; | ||
const std::string DEFAULT_CONTENT_VALUE_ENTITY_TYPE_HOST_PROCESS = "infra.host.process"; | ||
const std::string DEFAULT_CONTENT_KEY_PROCESS_PID = "pid"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
字段是如何跟安全保持一致的?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
找讯飞看了一下ebpf那边代码还比较乱,自己维护了一套constant,没有用公共的。
是否可以先合入,然后等ebpf合入后,两边再对齐一下?
|
||
const size_t ProcessTopN = 20; | ||
|
||
const std::string ProcessEntityCollector::sName = "process_entity"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: