Automation Pipeline3 min read

My Alerts Lived Only in My Chat App

I had a dashboard showing bot status, and my alerts fired correctly. But the two didn't know about each other. The record of what had fired lived only in a Telegram chat, and the dashboard couldn't show it.

#alerting#dashboard#telegram#observability#jsonl
Split illustration contrasting alerts piling up only in a Telegram chat with an alert history section on a dashboard
The alerts were firing, but you couldn't see the record anywhere outside the chat.

I could see state, not events

I run several bots on my own. Two things watch them. One is a dashboard that pulls current status onto a single screen. The other is a pair of alert scripts that send Telegram messages when a condition is met. One script fires when a gate trips, and the other fires when a bot breaks.

Both did their jobs. The problem was that they weren't connected. The alert scripts sent a message and left nothing behind. So to answer "what fired recently?" I had to scroll up through a Telegram chat instead of looking at the dashboard.

The dashboard only tells you about the present, not about past events. A green light now means things are fine now. It doesn't mean nothing happened in between.

Can your monitoring screen tell you which alerts fired in the last few hours, or does that answer live only in your messenger history?

Why this is a trap

If you build the alert channel and the dashboard separately, you end up here by default. An alert is a feature that ends at "send," so nothing in the code gives it a reason to keep a record. A dashboard is built to read current values, so it never had a place to read past events from.

The result is that your alert history exists in exactly one place: an external messenger. A chat is hard to search and hard to put next to your other views. When gate fires and bot breakage land in the same chat, a person has to sort them apart.

What would you do? Have the dashboard read Telegram, or have the sender write its own record?

The fix: write a line when you send

I chose to record at the sender. Both alert scripts now append a line to the same JSONL file whenever they send a message. Each line holds three things:

  • timestamp
  • kind (gate fire or bot breakage)
  • the message text that was sent

The dashboard reads the last 15 entries from that file and renders them as a third section. Each kind gets its own icon: 🤖 for gate fires, ⚠️ for bot breakage. The alert stream now shows up on the dashboard, not only in Telegram.

The change is small: 41 lines added and 1 removed across three files. The breakage-event script gained one line, the gate watcher gained 13, and the dashboard gained 28. There's no new service and no database, just one append-only text file.

Self-check

  • Can you see a list of recent alerts on your dashboard without opening your messenger?
  • Does the code that sends alerts also record that it sent them somewhere other than the messenger?
  • Are different kinds of alerts (a decision firing vs. a system breaking) distinguishable in that record?

The honest part

I have no evidence yet that this change caught a missed alert or sped up any response. The commit adds the feature and doesn't measure its effect. The number 15 has no basis either, and it may be too few on a day when alerts pile up. The record is written "when they send," and I can't tell from the commit message alone whether a failed send still gets recorded. The commit also says nothing about how long the file is kept or when it gets trimmed. All this fix does is make the alerts visible. It doesn't guarantee they're correct.

Related