-
Notifications
You must be signed in to change notification settings - Fork 392
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
const std::string ProcessorHostMetaNative::sName = "processor_host_meta_native"; | ||
|
||
bool ProcessorHostMetaNative::Init(const Json::Value& config) { | ||
auto hostType = ToString(getenv(DEFAULT_ENV_KEY_HOST_TYPE.c_str())); |
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.
新pr的实现也是每次再全新获取,跟之前提到的实现也不符合。
4110e3d
to
3e12438
Compare
Timer& operator=(const Timer&) = delete; | ||
Timer& operator=(Timer&&) = delete; | ||
~Timer() = default; | ||
static Timer* GetInstance() { |
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.
改成单例,之前prometheus等使用的地方没有问题?
const std::string ProcessorHostMetaNative::sName = "processor_host_meta_native"; | ||
|
||
bool ProcessorHostMetaNative::Init(const Json::Value& config) { | ||
auto hostType = ToString(getenv(DEFAULT_ENV_KEY_HOST_TYPE.c_str())); |
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.
新pr的实现也是每次再全新获取,跟之前提到的实现也不符合。
targetEvent->SetContent("binary", sourceEvent.GetContent(DEFAULT_CONTENT_KEY_PROCESS_BINARY)); | ||
targetEvent->SetContent("arguments", sourceEvent.GetContent(DEFAULT_CONTENT_KEY_PROCESS_ARGUMENTS)); | ||
targetEvent->SetContent("language", sourceEvent.GetContent(DEFAULT_CONTENT_KEY_PROCESS_LANGUAGE)); | ||
targetEvent->SetContent("containerID", sourceEvent.GetContent(DEFAULT_CONTENT_KEY_PROCESS_CONTAINER_ID)); |
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.
需要统一到constans里字段。需要避免同一场景一会下划线,一会大小写的问题。
class ProcessCollector : public BaseCollector { | ||
public: | ||
ProcessCollector() : mProcessSilentCount(INT32_FLAG(process_collect_silent_count)) { | ||
mName = "process"; |
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.
多处使用的字符串,避免直接使用字符串
} | ||
} | ||
|
||
void ProcessCollector::SortProcessByCpu(std::vector<ProcessStatPtr>& processStats, size_t topN) { |
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.
这里面实现并不只是sort还有获取,函数名不匹配
|
||
int readCount = 0; | ||
WalkAllProcess(PROCESS_DIR, [&](const std::string& dirName) { | ||
if (++readCount > mProcessSilentCount) { |
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.
这里要看下进程超多时,对timer框架的影响
1、是否影响其他场景
2、单次执行时间大于调度时间的策略
|
||
namespace logtail { | ||
|
||
const std::string ProcessorHostMetaNative::sName = "processor_host_meta_native"; |
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.
inner processor存在的必要性是什么?为什么不能collect时直接补充字段
const auto now = steady_clock::now(); | ||
|
||
// TODO: more accurate cache | ||
auto prev = GetPreProcessStat(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.
|
||
int readCount = 0; | ||
WalkAllProcess(PROCESS_DIR, [&](const std::string& dirName) { | ||
if (++readCount > mProcessSilentCount) { |
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: