Add RPC diagnostics with BD_RPC_DEBUG env var

- Add BD_RPC_DEBUG=1 for lightweight timing logs to stderr
- Log socket path, socket exists check, dial timing, health check timing
- Improve daemon status message when lock not held
- Helps field triage of connection issues without verbose daemon logs
- Fixes bd-j7e2
This commit is contained in:
Steve Yegge
2025-11-07 21:29:22 -08:00
parent 1c86fc1434
commit fe705befbe
4 changed files with 48 additions and 3 deletions

View File

@@ -117,7 +117,16 @@ func showDaemonHealth(global bool) {
}
if client == nil {
fmt.Println("Daemon is not running")
// Check if lock is held to provide better diagnostic message
beadsDir := filepath.Dir(socketPath)
running, _ := tryDaemonLock(beadsDir)
if running {
fmt.Println("Daemon lock is held but connection failed")
fmt.Println("This may indicate a crashed daemon. Try: bd daemons killall")
} else {
fmt.Println("Daemon is not running")
fmt.Println("Start with: bd daemon start")
}
os.Exit(1)
}
defer func() { _ = client.Close() }()