feat: publish standalone worker

Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
Gleb Tv
2026-07-13 17:55:14 +03:00
Коммит 2c7a0236da
309 изменённых файлов: 44004 добавлений и 0 удалений

29
internal/webapp/metrics_linux.go Обычный файл
Просмотреть файл

@@ -0,0 +1,29 @@
//go:build linux
package webapp
import (
"syscall"
)
// statDisk fills Total/Free/Used for a DiskSample via statfs(2).
// Linux-only because syscall.Statfs_t is platform-specific. Tests
// that exercise the metric paths stub statDisk at the function
// boundary so the build is hermetic.
func statDisk(mount string, d *DiskSample) error {
var st syscall.Statfs_t
if err := syscall.Statfs(mount, &st); err != nil {
return err
}
bsize := uint64(st.Frsize)
total := st.Blocks * bsize
free := st.Bavail * bsize
used := total - free
d.Total = total
d.Free = free
d.Used = used
if total > 0 {
d.UsedPct = pct(used, total)
}
return nil
}