Skip to content

Commit

Permalink
Enhance container ID extraction in ProcessTree and RawEventProcessor …
Browse files Browse the repository at this point in the history
…for improved clarity and functionality
  • Loading branch information
iritb committed Jan 12, 2025
1 parent b58055b commit 67c2923
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ProcessTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ std::shared_ptr<ProcessTreeItem> ProcessTree::AddProcess(enum ProcessTreeSource
// started by a web service or another system service that does not pass the container
// ID through the command line arguments.
Logger::Info("IB Updating containerid %s from cgroup for process %d, _cgroupContainerId %s, temp cgroupContainerid: %s ", process->_containerid.c_str(), pid, process->_cgroupContainerId.c_str(), cgroupContainerid.c_str());
auto __cgroupContainerid = ExtractContainerIdFromCgroup(pid);
if (process->_containerid.empty()) {
if (!cgroupContainerid.empty()) {
process->_containerid = cgroupContainerid;
Expand Down Expand Up @@ -656,7 +657,7 @@ std::string ProcessTree::ExtractContainerIdFromCgroup(const int pid)
}

containerid = pinfo->container_id();
Logger::Debug("IB (2) CGroup container id for %d is %s", pid, containerid.c_str());
Logger::Debug("IB CGroup container id for %d is %s", pid, containerid.c_str());
return containerid;
}

Expand Down
3 changes: 1 addition & 2 deletions RawEventProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ void RawEventProcessor::ProcessData(const void* data, size_t data_len) {
_pid = get_pid_from_event(event);
if (_pid != -1) {
if (_processTree) {
auto contId = _processTree->ExtractContainerIdFromCgroup(_pid);
Logger::Debug("IB RawEventProcessor: ProcessData for %d: ContainerId: %s", _pid, contId.c_str());
auto contId = _processTree->ExtractContainerIdFromCgroup(_pid);
}
}

Expand Down

0 comments on commit 67c2923

Please sign in to comment.