Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tellmewhendown-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tellmewhendown-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file tellmewhendown-0.1.0.tar.gz.

File metadata

  • Download URL: tellmewhendown-0.1.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for tellmewhendown-0.1.0.tar.gz
Algorithm Hash digest
SHA256 242b5e549f3c32577ffbf20cca7f6bc4a354fd5a14408142d097eaec4921b9fb
MD5 79652e01cae37fcd183c62803e701157
BLAKE2b-256 262575063e6c20e87ea4c7d5efa5536e1634eb2b1b2eb873bf44bac1ea7d99d2

See more details on using hashes here.

File details

Details for the file tellmewhendown-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tellmewhendown-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for tellmewhendown-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b42f919f563f6d6447a9dff11dd4314100fba77dfab30d709d85130abd35838
MD5 b15a90432e390f365c32200b2c1e8bd5
BLAKE2b-256 106c59ed0899a929264d4e0d47c7cb5adcd56ba4315607970a208b6d850e97cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page