My Health Check Watched the Wrong File
Описание и применение
Правило проверки работоспособности, основанное на возрасте лог‑файла, ошибочно пометило активные телеграм‑боты как мертвые, поскольку успешные проходы не записывали в лог. Анализ файлов состояния и кода показал, что процессы работают, а лог‑файл не отражает их состояние.
Задача
A health‑check rule that relied on log file age misidentified running Telegram poller jobs as dead because the logs were silent on successful passes.
Результат
The health‑check rule incorrectly treated active polling agents as dead because it relied on log file age, which does not reflect successful operation. The author demonstrated that state files and code analysis provide a more accurate picture of job health.
Рабочий процесс
- 1. Observe three listener jobs via launchctl and pgrep.
- 2. Check log files; all show last modified 2026‑08‑11.
- 3. Apply custom health‑check rule: log file age > threshold → job dead.
- 4. Flag jobs as dead.
- 5. Inspect script source: logs written only on startup or on exception; successful passes produce no output.
- 6. Monitor state files; notice timestamps advancing and content changes.
- 7. Analyze write locations in code to understand which writes indicate loop progress.
- 8. Conclude that log file age is an unreliable signal for job health.
- 9. Identify need for better health signals (e.g., explicit success receipts).
Доказательства
log files: sentinel_listen.log 8103 bytes mtime 2026-08-11
The successful path prints nothing.
An unchanged file does not prove no errors occurred.
- Дата записи: 2026-10-04T19:41:02.188Z