Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,6 @@ jobs:
files: |
artifacts/*
docs/*
SHA256SUMS
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Only **one primary source** is selected.

- Working directory
- Git repository name and branch
- Docker container name / image
- Container name / image (docker, podman, kubernetes, colima, containerd)
- Public vs private bind

#### Warnings
Expand Down Expand Up @@ -496,14 +496,14 @@ nix run github:pranshuparmar/witr -- --port 5000
| launchd | ❌ | ✅ | macOS only |
| Supervisor | ✅ | ✅ | |
| Cron | ✅ | ✅ | |
| Docker/containers | ✅ | ⚠️ | macOS: Docker Desktop runs in VM |
| Containers | ✅ | ⚠️ | macOS: Docker Desktop, Podman, Colima run in VM |
| **Health & Diagnostics** |
| CPU usage detection | ✅ | ✅ | |
| Memory usage detection | ✅ | ✅ | |
| Zombie process detection | ✅ | ✅ | |
| **Context** |
| Git repo/branch detection | ✅ | ✅ | |
| Container detection | ✅ | ⚠️ | macOS: limited to Docker Desktop |
| Container detection | ✅ | ⚠️ | macOS: limited to Docker Desktop, Podman, Colima |

**Legend:** ✅ Full support | ⚠️ Partial/limited support | ❌ Not available

Expand Down
15 changes: 9 additions & 6 deletions internal/proc/process_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,17 @@ func detectContainer(pid int) string {
cmdline := getCommandLine(pid)
lowerCmd := strings.ToLower(cmdline)

if strings.Contains(lowerCmd, "docker") {
switch {
case strings.Contains(lowerCmd, "docker"):
return "docker"
}
if strings.Contains(lowerCmd, "containerd") {
return "containerd"
}
if strings.Contains(lowerCmd, "colima") {
case strings.Contains(lowerCmd, "podman"):
return "podman"
case strings.Contains(lowerCmd, "kubepods"):
return "kubernetes"
case strings.Contains(lowerCmd, "colima"):
return "colima"
case strings.Contains(lowerCmd, "containerd"):
return "containerd"
}

return ""
Expand Down
15 changes: 10 additions & 5 deletions internal/proc/process_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,22 @@ func ReadProcess(pid int) (model.Process, error) {
cwd = "unknown"
}

// Container detection (simple: look for docker/containerd/kubepods in cgroup)
// Container detection
container := ""
cgroupFile := fmt.Sprintf("/proc/%d/cgroup", pid)
if cgroupData, err := os.ReadFile(cgroupFile); err == nil {
cgroupStr := string(cgroupData)
if strings.Contains(cgroupStr, "docker") {
switch {
case strings.Contains(cgroupStr, "docker"):
container = "docker"
} else if strings.Contains(cgroupStr, "containerd") {
container = "containerd"
} else if strings.Contains(cgroupStr, "kubepods") {
case strings.Contains(cgroupStr, "podman"):
container = "podman"
case strings.Contains(cgroupStr, "kubepods"):
container = "kubernetes"
case strings.Contains(cgroupStr, "colima"):
container = "colima"
case strings.Contains(cgroupStr, "containerd"):
container = "containerd"
}
}

Expand Down
33 changes: 28 additions & 5 deletions internal/source/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,38 @@ func detectContainer(ancestry []model.Process) *model.Source {
}
content := string(data)

if strings.Contains(content, "docker") ||
strings.Contains(content, "containerd") ||
strings.Contains(content, "kubepods") {

switch {
case strings.Contains(content, "docker"):
return &model.Source{
Type: model.SourceContainer,
Name: "docker",
Confidence: 0.9,
}
case strings.Contains(content, "podman"):
return &model.Source{
Type: model.SourceContainer,
Name: "podman",
Confidence: 0.9,
}
case strings.Contains(content, "kubepods"):
return &model.Source{
Type: model.SourceContainer,
Name: "kubernetes",
Confidence: 0.9,
}
case strings.Contains(content, "colima"):
return &model.Source{
Type: model.SourceContainer,
Name: "container",
Name: "colima",
Confidence: 0.9,
}
case strings.Contains(content, "containerd"):
// Only match containerd if not already matched by docker/kubernetes/colima
return &model.Source{
Type: model.SourceContainer,
Name: "containerd",
Confidence: 0.8,
}
}
}
return nil
Expand Down
4 changes: 3 additions & 1 deletion internal/source/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ func DetectPrimary(chain []model.Process) string {
switch p.Command {
case "systemd":
return "systemd"
case "dockerd", "containerd":
case "dockerd", "containerd", "kubelet":
return "docker"
case "podman":
return "podman"
case "pm2":
return "pm2"
case "cron":
Expand Down
12 changes: 12 additions & 0 deletions internal/source/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,33 @@ var knownSupervisors = map[string]string{
"pm2": "pm2",
"pm2 god": "pm2",
"supervisord": "supervisord",
"supervisor": "supervisord",
"gunicorn": "gunicorn",
"uwsgi": "uwsgi",
"s6-supervise": "s6",
"s6": "s6",
"s6-svscan": "s6",
"runsv": "runit",
"runit": "runit",
"runit-init": "runit",
"openrc": "openrc",
"openrc-init": "openrc",
"monit": "monit",
"circusd": "circus",
"circus": "circus",
"systemd": "systemd service",
"systemctl": "systemd service",
"daemontools": "daemontools",
"init": "init",
"initctl": "upstart",
"tini": "tini",
"docker-init": "docker-init",
"podman-init": "podman-init",
"smf": "smf",
"launchd": "launchd",
"god": "god",
"forever": "forever",
"nssm": "nssm",
}

func detectSupervisor(ancestry []model.Process) *model.Source {
Expand Down
Loading