Skip to content

Commit

Permalink
Adding a check if the container is still being monitord before readin…
Browse files Browse the repository at this point in the history
…g from perf buffer

Signed-off-by: Amit Schendel <[email protected]>
  • Loading branch information
amitschendel committed Jun 5, 2024
1 parent c2d0f4d commit 7eb0aae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/containerwatcher/v1/container_watcher_private.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ func (ch *IGContainerWatcher) containerCallback(notif containercollection.PubSub
// Read the syscall tracer events in a separate goroutine.
go func() {
for {
if !ch.timeBasedContainers.Contains(notif.Container.Runtime.ContainerID) && !ch.preRunningContainersIDs.Contains(notif.Container.Runtime.ContainerID) {
logger.L().Info("stop monitor on container - container has been removed",
helpers.String("container ID", notif.Container.Runtime.ContainerID),
helpers.String("k8s workload", k8sContainerID))
return
}

evs, err := ch.syscallTracer.Read(notif.Container.Runtime.ContainerID)
if err != nil {
logger.L().Debug("syscalls perf buffer closed", helpers.String("error", err.Error()))
Expand Down

0 comments on commit 7eb0aae

Please sign in to comment.