Skip to content

[log] Add debug logging to extractContainerIDFromCgroupFiles - #9661

Merged
lpcox merged 1 commit into
mainfrom
log/sys-container-cgroup-extraction-9bee5c4dd7cf1efa
Jul 20, 2026
Merged

[log] Add debug logging to extractContainerIDFromCgroupFiles#9661
lpcox merged 1 commit into
mainfrom
log/sys-container-cgroup-extraction-9bee5c4dd7cf1efa

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Adds 5 meaningful debug log calls to internal/sys/container.go in the extractContainerIDFromCgroupFiles function, which previously silently iterated cgroup files with no observability.

Changes

File modified: internal/sys/container.go

The extractContainerIDFromCgroupFiles function now logs:

  • How many cgroup files are being scanned
  • When a file is unreadable (with path and error)
  • When a container ID is successfully extracted (with path and ID)
  • When no container ID is found in a specific file
  • When all files are exhausted without finding any container ID

Motivation

Container detection failures are hard to diagnose. Previously, this function silently skipped unreadable files and returned empty without any trace of what was attempted. With DEBUG=sys:* enabled, operators can now see exactly which cgroup files were probed and why extraction succeeded or failed.

Validation

  • go vet ./internal/sys/
  • go test ./internal/sys/
  • go build

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Go Logger Enhancement · 181.9 AIC · ⊞ 7.7K ·

Add meaningful debug logging to the cgroup file scanning function
in internal/sys/container.go to help troubleshoot container detection
issues. The new log calls record:
- How many cgroup files are being scanned
- When a file is unreadable (with path and error)
- When a container ID is successfully extracted (with path and ID)
- When no container ID is found in a given file
- When all files have been exhausted without finding an ID

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels Jul 19, 2026
@lpcox
lpcox marked this pull request as ready for review July 19, 2026 23:53
Copilot AI review requested due to automatic review settings July 19, 2026 23:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds diagnostic logging to improve cgroup-based container ID detection observability.

Changes:

  • Logs cgroup scan progress, unreadable files, and unsuccessful extraction.
  • Logs the source and ID when extraction succeeds.
Show a summary per file
File Description
internal/sys/container.go Adds debug logging around cgroup file scanning.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Medium

@lpcox
lpcox merged commit bbf1518 into main Jul 20, 2026
23 checks passed
@lpcox
lpcox deleted the log/sys-container-cgroup-extraction-9bee5c4dd7cf1efa branch July 20, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants