Connection lost. The server may be restarting (after a crash or a redeploy) or waking up from sleep. The numbers below are from the last answer; actions are paused.
Self-monitoring incident response lab
Overview
CPU
--%
of one core
Memory (RSS)
--MB
learning baseline
Connecting to the watchdog…
Waiting for the first status update.
Watchdog
every 2 s
Baseline
--
Last snapshot
--
A mini SRE lab in FastAPI: it detects its own CPU and memory anomalies, writes incident reports, and restores from snapshots.
Everything on this page is live data from this server's own process. This is a shared instance, so everyone visiting sees the same readings, incidents and faults.
Every incident this server has opened, newest first. Time to detect runs from the fault (or the first anomalous sample) to the incident opening; time to recover from opening to resolution. Both are demo measurements from this server's own clock.
No Gemini key is configured on this server, so reports come from DeepBell's built-in template, built from the same telemetry.
Alert rules watch one metric each. A rule is pending while its condition is true but has not lasted long enough, firing once it has lasted its full duration, and resolved when the condition clears. The rules are read at startup from target_app/alert_rules.json: edit that file and restart to change them.
Rules 0
Checking…
Recent changes
newest first
Loading…
Resource telemetry timeline
CPU and resident memory of this process, last 2 min. Shaded spans are open incidents; blank spans had no samples.
live, every 2 s
CPU% of one coreMemory (RSS)MB
The charts need Chart.js from a CDN, which did not load. The table below has the same samples.
Detector
--
Baseline
--
CPU, 95th percentile
--
Memory, median
--
Opens after
2 anomalous samples in a row
Closes after
3 normal samples in a row
Current streaks
--
Isolation Forest fits
--
A sample is a candidate when CPU is 15 points or memory 30 MB above the baseline. The Isolation Forest then has to agree it is an outlier, and it has to happen 2 times in a row, so a single page load or garbage-collection blip never opens an incident.
What the detector sees
Each sample as a point: CPU against memory. Points beyond either alert line are candidates for the Isolation Forest.
Latest samples
newest first
Time
CPU %
Memory MB
Memory vs baseline
Watchdog
Loading samples…
Cause a real failure in this server and watch the pipeline react in Live results. Faults are shared by everyone on this demo, capped, and each has a 20 s cooldown.
Fault injection
Each fault asks for confirmation first. The caps below are enforced by the server.
CPU spike
Runs a busy loop in a background thread, so CPU jumps well above the baseline.
What you will see: CPU crosses the alert line, an incident opens after 2 anomalous samples in a row, and it closes after 3 normal ones.
5 s at most
20 s cooldown
Memory leak
Allocates 60 MB and holds it until it is released. Freed automatically after 5 minutes.
What you will see: memory jumps by 60 MB and the incident stays open until the memory is released.
0 of 120 MB held
60 MB a step, 120 MB held at most
20 s cooldown
Database corruption
Writes garbage over the SQLite file header, so every query fails until a snapshot is restored.
What you will see: the next database check fails, an incident opens at once, and it stays open until a snapshot is restored in the Time Machine.
recoverable from a snapshot
20 s cooldown
Fatal crash
Disabled on the public demo: it would take the site down for everyone. Run DeepBell locally to try it; the run_all.py supervisor restarts the process.
local runs only
Live results
Last 2 minutes. Red points are samples the watchdog flagged.
The app's own SQLite database holds sample transactions. Every 30 s it is copied to a snapshot if its contents changed, and the newest 10 are kept. Corrupt it in the Chaos Lab, then roll back here.
The database is unreadable: . Restore the newest readable snapshot to recover.
Snapshots
newest first
Taken
Rows
Size
Action
Loading snapshots…
Every 30 s the snapshot thread compares app.db with the newest snapshot.
If it changed, it copies the file and keeps the copy only if it passes PRAGMA quick_check.
Restore copies a snapshot over app.db and checks it at once, which closes a database incident.
Transactions
Sample rows in the live database, newest first.
Time
Amount
ID
Loading transactions…
Why it exists
Most monitoring stops at the alert: a graph turns red and a person takes over. DeepBell is a small lab for what comes next. It decides that something is really wrong, writes down what happened, and gets the data back to a known good state, on a target small enough to break on purpose: its own process.
Incidents and reportstimeline with alerts and likely cause, reports/*.md
Recover
App databaseapp.db, sample transactions
Snapshot threadcopies it every 30 s if it changed
Snapshotsbackups/*.db.bak, newest 10
Rollbackfrom the Time Machine, the guided demo or the startup check
Serve
APIFastAPI in one uvicorn worker; all state lives in this process
UIJinja template and plain JavaScript, polling /api/status every 2 s
Everything runs in one Python process. The full step-by-step flows are in docs/process-flows.md.
Design decisions
Three gates before an incident. A sample must be 15 CPU points or 30 MB above the baseline (95th-percentile CPU and median memory of the last 150 normal samples), the Isolation Forest must call it an outlier, and it must happen 2 samples in a row; 3 normal samples close it. On its own the forest flagged ordinary jitter, and a fixed threshold alone ignores what normal looks like for this process.
Open incidents stay out of the baseline, so a leak that is still held never becomes the new normal.
Incident history lives in metrics.db, not app.db, so corrupting or rolling back the application database never rewrites it.
Caps and cooldowns for a public demo. CPU spikes last at most 5 s, leaks are 60 MB a step and 120 MB in total, every fault has a 20 s shared cooldown, leaked memory is freed after 5 minutes, and the crash fault and API-key form are off. The guided demo runs on the server, one run at a time, so a closed tab cannot leave a fault behind.
A single worker by design. Telemetry, open incidents, cooldowns and leaked memory are process state. Running more workers would need a shared store, which this lab does not need.
Template reports by default. They are free, deterministic and testable; Gemini (through LangChain) is optional and falls back to the template on any error. Every report is labelled with what wrote it.
Tech stack
FastAPI, Uvicorn
the API and the single server process (Python 3.11 and 3.12)
psutil
CPU and resident memory of the process
scikit-learn, NumPy
Isolation Forest that confirms anomalies
SQLite
app data, metrics, incident history and snapshots
LangChain, Gemini
optional AI-written reports; a built-in template otherwise
Jinja2, Chart.js, marked
the UI, with no build step
prometheus-client, Grafana
a /metrics endpoint and a ready-made dashboard (see the README)
pytest, ruff, GitHub Actions
tests, lint and CI
Docker, Render
the container and the public demo
Limitations
It monitors only itself, on two signals (CPU and resident memory). It is not a general monitoring tool.
The minimum deviations are fixed, so smaller spikes and leaks are deliberately ignored.
Snapshots are not point-in-time recovery: a rollback loses whatever changed since the snapshot.
At runtime the rollback is manual (or part of the guided demo); it is automatic only in the startup check.
There is no authentication. Public demo mode caps the damage, but any visitor can inject the capped faults.
Times to detect and recover are measured on injected faults in this lab and say nothing about a production system.
On the free hosting plan the disk is ephemeral, so history resets when the service restarts.