Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions decisionmaker/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ func (svc *Service) ProcessIntents(ctx context.Context, intents []*domain.Intent
if process.Command == pauseCommand {
continue
}
if !regexp.MustCompile(intent.CommandRegex).MatchString(process.Command) {
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

The regex is being compiled on every iteration of the process loop. This is inefficient and can cause performance issues when processing pods with many processes. Consider compiling the regex once outside the loop or caching compiled regex patterns.

Copilot uses AI. Check for mistakes.
continue
}
Comment on lines +87 to +89
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

The new command regex filtering logic lacks test coverage. The ProcessIntents function now filters processes based on CommandRegex, but there are no tests verifying this behavior. Consider adding tests that verify processes are correctly filtered based on the regex pattern, including edge cases like invalid regex patterns or partial matches.

Copilot uses AI. Check for mistakes.
schedulingIntent := &domain.SchedulingIntents{
Priority: intent.Priority > 0,
ExecutionTime: uint64(intent.ExecutionTime),
Expand Down Expand Up @@ -186,9 +189,10 @@ func (svc *Service) parseCgroupToPodInfo(rootDir string, line string, pid int, p
return nil
}

var (
podRegex = regexp.MustCompile(`pod([0-9a-fA-F_]+)(?:\.slice)?`)
)
// Support multiple cgroup formats:
// - systemd: kubelet-kubepods-pod20da609e_6973_4463_a1f9_2db9bcc5becc.slice (underscores)
// - cgroupfs: /kubepods/burstable/pod31e4e721-a5a0-421a-ae1d-b7971ae30d6e/ (dashes)
var podRegex = regexp.MustCompile(`pod([0-9a-fA-F]{8}[-_][0-9a-fA-F]{4}[-_][0-9a-fA-F]{4}[-_][0-9a-fA-F]{4}[-_][0-9a-fA-F]{12})`)

// getPodInfoFromCgroup extracts pod information from cgroup path
func (svc *Service) getPodInfoFromCgroup(cgroupPath string) (podUID string, containerID string, err error) {
Expand Down
Loading