Heartbeat Monitoring

Heartbeat Monitoring

Keep tabs on long-running jobs and scheduled tasks. Get alerted when they stop sending heartbeats.

What is Heartbeat Monitoring?

Heartbeat monitoring sends periodic "I'm alive" signals to SEER. If your job stops sending heartbeats, SEER detects the silence and alerts you that something went wrong.

When Heartbeats Arrive

Job is healthy and running normally. No alerts sent.

When Heartbeats Stop

Job stopped unexpectedly. SEER sends alert via Slack/email.

When to Use Heartbeat Monitoring

Long-Running Jobs

Jobs that run for hours or days (data migrations, ML training, batch processing)

# Send heartbeat every 10 minutes
while processing:
    process_batch()
    seer.heartbeat("ml-training", {"epoch": i})
Scheduled Cron Jobs

Jobs that should run on a schedule (daily backups, hourly sync jobs)

# In your cron job (runs daily at 2am)
def daily_backup():
    seer.heartbeat("daily-backup")
    run_backup()

💡 Set expected interval to 24 hours. Get alerted if backup doesn't run.

Always-On Services

Background workers or daemons that should always be running

# Worker process sends heartbeat every 5 min
while True:
    seer.heartbeat("queue-worker")
    time.sleep(300)

How to Implement Heartbeat Monitoring

Using the Python SDK
Simple heartbeat implementation with seerpy
from seerpy import Seer
import time

seer = Seer(apiKey='YOUR_API_KEY')

def long_running_job():
    for i in range(100):
        # Do work
        process_batch(i)
        
        # Send heartbeat every 10 iterations
        if i % 10 == 0:
            seer.heartbeat(
                job_name="batch-processor",
                metadata={
                    "batch": i,
                    "progress": f"{i}%",
                    "status": "processing"
                }
            )
        
        time.sleep(60)  # Simulate work

long_running_job()

Tip: Include progress information in metadata to track job state in the dashboard.

Configure Heartbeat Alerts in Dashboard

After your job starts sending heartbeats, configure when SEER should alert you:

  1. 1. Go to Job Settings

    Dashboard → Your Job → Settings Tab → Heartbeat Monitoring

  2. 2. Enable Heartbeat Monitoring

    Toggle "Enable Heartbeat Monitoring" to ON

  3. 3. Set Expected Interval

    How often should heartbeats arrive? (e.g., 5 minutes for continuous jobs, 24 hours for daily cron jobs)

  4. 4. Configure Notifications

    Go to Notifications tab and connect Slack or email to receive alerts

Alert Timing: SEER sends an alert when no heartbeat is received for 2x the expected interval (e.g., if interval is 5 minutes, alert after 10 minutes of silence)

Best Practices

Choose Appropriate Intervals
  • Short jobs (under 5 min): No heartbeat needed, just use seer.monitor()
  • Medium jobs (5-60 min): Send heartbeat every 5-10 minutes
  • Long jobs (over 1 hour): Send heartbeat every 15-30 minutes
  • Scheduled jobs: Set interval to your cron schedule (e.g., 24 hours for daily jobs)
Don't Over-Send Heartbeats

Sending heartbeats too frequently wastes API calls and doesn't add value.

❌ Don't Do This

# Heartbeat every second
# = 3,600 API calls/hour!
while True:
    seer.heartbeat("job")
    time.sleep(1)

✅ Do This Instead

# Heartbeat every 5 minutes
# = 12 API calls/hour
while True:
    seer.heartbeat("job")
    time.sleep(300)
Include Metadata

Add context to heartbeats so you can see job state in the dashboard:

seer.heartbeat("etl-job", metadata={
    "stage": "transform",
    "records_processed": 1500,
    "progress": "75%",
    "current_batch": 15
})

Related Documentation