Skip to content

Commit

Permalink
cleanup(libsinsp): don't count sanboxes as missing_container_images
Browse files Browse the repository at this point in the history
Signed-off-by: Melissa Kilby <[email protected]>
  • Loading branch information
incertum committed Oct 30, 2023
1 parent 910dc36 commit c2f67ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion userspace/libsinsp/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ bool sinsp_container_manager::remove_inactive_containers()
if (m_inspector->m_sinsp_stats_v2)
{
m_inspector->m_sinsp_stats_v2->m_n_missing_container_images = 0;
// Will include pod sanboxes, but that's ok
m_inspector->m_sinsp_stats_v2->m_n_containers = containers->size();
}
for(auto it = containers->begin(); it != containers->end();)
Expand All @@ -99,8 +100,9 @@ bool sinsp_container_manager::remove_inactive_containers()
if (m_inspector->m_sinsp_stats_v2)
{
auto container_info = container.get();
if (!container_info || (container_info && container_info->m_image.empty()))
if (!container_info || (container_info && !container_info->m_is_pod_sandbox && container_info->m_image.empty()))
{
// Only count missing container images and exclude sandboxes
m_inspector->m_sinsp_stats_v2->m_n_missing_container_images++;
}
}
Expand Down

0 comments on commit c2f67ce

Please sign in to comment.