Resolved conflict in internal/records/records.go:
- Upstream refactor moved deletion code to records_deletion.go and
switched averaging functions from package-level globals to local
variables (var row StatsRecord / params := make(dbx.Params, 1)).
- Kept AverageProbeStats and rewrote it to match the new local-variable
pattern.
- Dropped duplicated deletion helpers from records.go (they now live in
records_deletion.go).
- Added "network_probe_stats" to the collections list in
records_deletion.go:deleteOldSystemStats so probe stats keep the same
retention policy.
Resolve the target hostname before starting the timer so the
measurement reflects pure TCP handshake time only.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the ping-command-only implementation with a three-tier
approach using golang.org/x/net/icmp:
1. Raw socket (ip4:icmp) — works with root or CAP_NET_RAW
2. Unprivileged datagram socket (udp4) — works on Linux/macOS
without special privileges
3. System ping command — fallback when neither socket works
The method is auto-detected on first probe and cached for all
subsequent calls, avoiding repeated failed attempts.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use shared http.Client in ProbeManager to avoid connection/transport leak
- Skip probe goroutine and agent request when system has no enabled probes
- Validate HTTP probe target URL scheme (http:// or https://) on creation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements the core probe execution engine (ProbeManager) that runs
network probes on configurable intervals, collects latency samples,
and aggregates results over a 60s sliding window. Adds two new
WebSocket handlers (SyncNetworkProbes, GetNetworkProbeResults) for
hub-agent communication and integrates probe lifecycle into the agent.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Some enterprise NVMe drives (e.g. Dell Ent NVMe CM7 U.2) report capacity
via nvme_total_capacity instead of user_capacity.bytes in smartctl output.
The NVMe SMART parser now falls back to nvme_total_capacity when
user_capacity.bytes is zero.
- move hub's GetEnv function to new utils package to more easily share
across different hub packages
- change System.HasUser to take core.Record instead of user ID string
- add tests
Previously, the agent shared a single PrevReadTime timestamp across all
collection intervals (e.g., 1s and 60s). This caused the 60s collector
to divide its accumulated 60s byte delta by the tiny time elapsed since
the last 1s collection, resulting in astronomically inflated network
rates. The fix introduces per-cache-time read time tracking, ensuring
calculations for each interval use their own independent timing context.
- Match FILESYSTEM directly against I/O devices if partition lookup
fails
- Fall back to the most active I/O device if no root device is detected
- Add WARN logs in final fallback case to most active device
findIoDevice now normalizes device names and falls back to prefix-based
matching when partition names differ from IOCounter names (e.g. nda0p2 →
nda0 on FreeBSD). The most-active prefix-related device is selected,
avoiding the broad "most active of all" heuristic that caused Docker
misattribution in #1737.