📦 Ship to Production — app9.3
Developer CourseModule 9: Ship to Productionapp9.3
Reading12 min

Error Budgets, Rate Limits, and Monitoring

📦 Module 9: Ship to Production

Error Budgets, Rate Limits, and Monitoring

Your app will fail. The question is: how often is acceptable?

Rate limits

EnergyAtIT is free until we get your feedback. There is no paid tier.

When you hit a limit, you get a 429 Too Many Requests response. The Retry-After header tells you how long to wait.

import time

response = requests.get(url, headers=headers)
if response.status_code == 429:
    wait = int(response.headers.get("Retry-After", 60))
    time.sleep(wait)
    response = requests.get(url, headers=headers)  # Retry once

Error Budgets

An error budget is the maximum amount of downtime you can tolerate per year.

SLADowntime/YearDowntime/MonthWhat It Means
99%3.65 days7.3 hoursFine for internal dashboards
99.9%8.76 hours43.8 minutesStandard for production apps
99.99%52.6 minutes4.38 minutesTAQA / Khazna SLA territory

If your app has 99.9% uptime, you have 8 hours and 46 minutes per year of acceptable failure. That sounds like a lot until a bad deploy eats 4 hours on a Friday.

Monitoring with /health

Every production app needs a health check. EnergyAtIt provides one:

curl https://app.energyatit.com/api/v1/health
curl.exe "https://app.energyatit.com/api/v1/health"

Build one for your app too:

@app.route("/health")
def health():
    checks = {
        "api_reachable": ping_energyatit(),
        "db_connected": check_db(),
        "last_reading_fresh": last_reading_age() < 300  # < 5 minutes
    }
    ok = all(checks.values())
    return {"status": "ok" if ok else "degraded", "checks": checks}, 200 if ok else 503

Point your monitoring tool (UptimeRobot, Datadog, even a cron job with curl) at that endpoint. Alert when it returns 503.

The apps that survive production are the ones that tell you when they are broken.

Log in to track your progress and earn certifications.