Not every error is an error
  • Tanga
  • Telegram
  • Monitoring
  • Python

Not every error is an error

65
Today the Tanga bot sent me "⚠️ Bot error: NetworkError, httpx.ReadError". That kind of message always makes you tense up. I opened the logs. The error happened while the bot was polling Telegram for new messages: at night Telegram's server answered "Bad Gateway" four times in five seconds, and during the day it dropped the connection once. The library retries such a request on its own, and Telegram keeps the messages until the bot picks them up. Nothing was lost. Fourteen such alerts in fourteen days — all of this kind. The problem wasn't the error, it was the alert: a signal about an outage that heals itself drowns out the real errors. Now these drops only go to the log. I get a message only if the connection is really gone — ten failures in ten minutes. There was one catch: in python-telegram-bot, BadRequest also inherits from NetworkError, yet it is a real bug. I kept that one separate. Takeaway: when there are too many warnings, they mean nothing.