Report from inside your app to TellMeWhenDown — cron heartbeats and self-checks in one line.
Project description
tellmewhendown
Report from inside your app to TellMeWhenDown — cron heartbeats and self-checks in one line. Zero dependencies (stdlib only), never raises, never slows a request.
pip install tellmewhendown
Put your app's API key (from your app's Setup tab) in the environment:
TMWD_API_KEY=tmwd_...
Heartbeats — "alert me if this stops running"
Call at the end of any scheduled job. If the job dies, the beat stops coming, and that silence is what alerts you.
from tellmewhendown import tmwd
# after your cron job finishes:
tmwd.heartbeat("nightly-backup")
# or decorate the whole job — a raising job sends nothing (which is the point):
@tmwd.beat("nightly-backup")
def run_backup():
...
Self-checks — "report what only the app can see"
import time
from tellmewhendown import tmwd
started = time.monotonic()
try:
db.execute("select 1")
tmwd.check("db", status="ok", latency_ms=(time.monotonic() - started) * 1000)
except Exception as err:
tmwd.check("db", status="fail", detail={"error": str(err)})
Two consecutive fail reports open an incident and email you; the next ok
resolves it. Monitors register themselves on the first signal — nothing to
configure on the dashboard first.
Declare — "alert me even if a job never runs once"
A job that never sends its first signal has no monitor, so its silence is invisible. Declaring registers everything up front, with the real schedule:
# once at startup (idempotent — safe to call every boot):
tmwd.declare([
{"kind": "heartbeat", "type": "nightly-backup", "interval_seconds": 86400},
{"kind": "check", "type": "db", "interval_seconds": 3600},
])
Framework notes
- Django: call from management commands, Celery tasks, or a periodic task.
- Flask / FastAPI: call from your scheduled jobs (APScheduler, Celery) or a small health task.
- Anywhere else: it's one POST — see the ingest API docs.
API
from tellmewhendown import TellMeWhenDown
client = TellMeWhenDown(
api_key="tmwd_...", # default: os.environ["TMWD_API_KEY"]
base_url="https://...", # default: https://tellmewhendown.com
timeout=5.0, # seconds
on_error=lambda msg: None, # observe failures; reporting never raises
)
Every method returns True on success, False on any failure. A failure to
report is never allowed to become your app's failure.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tellmewhendown-0.1.1.tar.gz.
File metadata
- Download URL: tellmewhendown-0.1.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
189a710fffad866209e9b5f3e5ec9cefdd0fe8daef353c886631fbce89de802d
|
|
| MD5 |
1d59600c6e3456dcefa4ee67d803f71a
|
|
| BLAKE2b-256 |
16fd3f581e1f320278015d078e54a8c1ac070dd5092c201a7e778add1ffeb33d
|
File details
Details for the file tellmewhendown-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tellmewhendown-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
708c1e65e3755a1d09ad9a228df9ff53740b570f27b037bcebdf9061231e69b1
|
|
| MD5 |
f4dd36f675c7016b43ae4e70f10de6c5
|
|
| BLAKE2b-256 |
e6641d1e16c1c023822b58de7bb2ef3f06195dd6d70580abd74aa7694b6e4a87
|