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

feat: support host monitor #1890

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

Conversation

Abingcbc
Copy link
Collaborator

  1. 打通进程元信息采集链路

TODO:

  1. 支持更多字段
  2. 可观测指标

@Abingcbc Abingcbc force-pushed the host_monitor branch 6 times, most recently from 6150e52 to bfdd9c2 Compare November 19, 2024 06:27
core/common/timer/HostMonitorTimerEvent.cpp Outdated Show resolved Hide resolved
core/models/PipelineEventGroup.h Outdated Show resolved Hide resolved
core/runner/sink/http/HttpSink.cpp Show resolved Hide resolved
core/host_monitor/collector/MockCollector.cpp Outdated Show resolved Hide resolved
core/host_monitor/collector/CollectorManager.cpp Outdated Show resolved Hide resolved
core/constants/EntityConstants.cpp Show resolved Hide resolved
core/host_monitor/SystemInformationTools.cpp Show resolved Hide resolved
core/common/FileSystemUtil.h Outdated Show resolved Hide resolved
core/common/StringTools.cpp Outdated Show resolved Hide resolved
core/common/timer/HostMonitorTimerEvent.cpp Outdated Show resolved Hide resolved
core/plugin/input/InputHostMeta.h Outdated Show resolved Hide resolved
core/plugin/input/InputHostMeta.h Outdated Show resolved Hide resolved
core/plugin/input/InputHostMeta.cpp Outdated Show resolved Hide resolved
core/plugin/input/InputHostMeta.cpp Show resolved Hide resolved
core/host_monitor/HostMonitorInputRunner.cpp Outdated Show resolved Hide resolved
core/host_monitor/HostMonitorInputRunner.cpp Outdated Show resolved Hide resolved
core/host_monitor/HostMonitorInputRunner.cpp Outdated Show resolved Hide resolved
core/common/timer/Timer.h Show resolved Hide resolved
core/runner/sink/http/HttpSink.cpp Show resolved Hide resolved
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));
Copy link
Collaborator

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";
Copy link
Collaborator

Choose a reason for hiding this comment

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

多处使用的字符串,避免直接使用字符串


namespace logtail {

const std::string ProcessorHostMetaNative::sName = "processor_host_meta_native";
Copy link
Collaborator

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

image
mPrevProcessStat 使用场景很局部,都是内部使用,保持统一。


int readCount = 0;
WalkAllProcess(PROCESS_DIR, [&](const std::string& dirName) {
if (++readCount > mProcessSilentCount) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

个数控制是不是也在控制缓存里的?不应该只是控制去直接操作系统交互的吗

core/common/MachineInfoUtil.cpp Show resolved Hide resolved
core/common/MachineInfoUtil.cpp Show resolved Hide resolved
core/common/timer/Timer.h Show resolved Hide resolved
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.

3 participants