TL;DR: Use a dedicated heartbeat monitor for a cron or background job that might never start, then mirror job_started, job_finished, and job_failed events into logs for diagnosis. Logs, error tracking, and tracing can explain a failure that emitted evidence; they cannot prove that an expected fintech notification run never happened. My default is therefore a heartbeat service first and structured logs second, with the final vendor choice driven by signal quality, paging integration, residency requirements, and on-call capacity rather than by feature count.
For a bounded production scenario, I use a notification service that is expected to deliver payment and account messages on a five-minute schedule. That interval is illustrative, not a measured customer incident. The useful failure is deliberately awkward: the scheduler does not invoke the worker, so there is no exception, log line, or span. The SLO question is not "did the code return an error?" but "did the expected run report completion before its deadline?"
Short answer: give each scheduled job a distinct heartbeat and deadline. Page only after the deadline plus an intentional grace period, and keep run logs as supporting evidence. Everything else starts from that invariant.
1. Should Node SaaS teams use Healthchecks or an alternative for cron job monitoring?
A log pipeline observes emitted records. A dead man's switch observes the absence of an expected record. Those are different signals, and treating them as interchangeable creates a blind spot precisely where a scheduler, deployment, credential, or process failure prevents the first line of job code from running.
This was the correction in my decision process: I initially expected structured logs to be the easiest setup because they make the failure timeline searchable, then I asked what produces a signal when the timeline is empty. The answer cannot be another log query. A separate heartbeat service owns a clock, expects a check-in, and declares the run late when that check-in does not arrive. For a beginner operating a Node SaaS service, that narrow contract is easier to test than a custom log poller, even though the preventative example below is deliberately written in Go to make the HTTP behavior explicit.
Infrai can store job_started, job_finished, and job_failed events through a plain REST API, which is useful when a team wants one key and no client SDK version to maintain. It does not provide a dead man's switch, heartbeat monitor, notification router, or threshold rule engine. Alerting from its logs requires a polling loop you own, so I would not make that loop the primary missed-run detector. Its trace_id and span_id log fields can correlate records, but there is no distributed tracing query or span tree for reconstructing a deeper execution path.
No event is an event.
2. Put completion, not startup, on the critical path
A startup ping answers only whether the process entered the job. For delivery monitoring, completion is the stronger success signal: it proves that the bounded unit of work reached the point the team defines as done. Send a failure signal when the job returns an error, and let the external deadline catch the cases in which the process is killed before it can report either outcome.
The following Go program wraps a real command and reports start, success, or failure to URLs supplied by the selected heartbeat provider. It uses explicit methods, checks response status, honors Retry-After on HTTP 429, and caps retries. Duplicate check-ins must be tolerated by the chosen provider; this client never turns an uncertain response into a second job execution.
package main
import (
"bytes"
"context"
"fmt"
"io"
"net/http"
"os"
"os/exec"
"strconv"
"strings"
"time"
)
func ping(ctx context.Context, url string) error {
if url == "" {
return fmt.Errorf("heartbeat URL is empty")
}
client := &http.Client{Timeout: 10 * time.Second}
delay := time.Second
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, nil)
if err != nil {
return err
}
resp, err := client.Do(req)
if err == nil {
resp.Body.Close()
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
return nil
}
if resp.StatusCode != http.StatusTooManyRequests {
return fmt.Errorf("heartbeat returned %s", resp.Status)
}
if seconds, parseErr := strconv.Atoi(resp.Header.Get("Retry-After")); parseErr == nil && seconds > 0 {
delay = time.Duration(seconds) * time.Second
}
}
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(delay):
}
delay *= 2
}
return fmt.Errorf("heartbeat retries exhausted")
}
func mirrorLog(ctx context.Context, payload, eventID string) error {
if payload == "" {
return fmt.Errorf("log payload is empty")
}
apiKey := os.Getenv("INFRAI_API_KEY")
if apiKey == "" {
return fmt.Errorf("INFRAI_API_KEY is empty")
}
baseURL := strings.TrimRight(os.Getenv("INFRAI_BASE_URL"), "/")
if baseURL == "" {
return fmt.Errorf("INFRAI_BASE_URL is empty")
}
client := &http.Client{Timeout: 10 * time.Second}
delay := time.Second
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequestWithContext(ctx, http.MethodPost,
baseURL+"/logs/ingest", bytes.NewBufferString(payload))
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", eventID)
resp, err := client.Do(req)
if err == nil {
body, readErr := io.ReadAll(resp.Body)
resp.Body.Close()
if readErr != nil {
return readErr
}
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
return nil
}
if resp.StatusCode != http.StatusTooManyRequests {
return fmt.Errorf("log ingest returned %s: %s", resp.Status, body)
}
if seconds, parseErr := strconv.Atoi(resp.Header.Get("Retry-After")); parseErr == nil && seconds > 0 {
delay = time.Duration(seconds) * time.Second
}
}
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(delay):
}
delay *= 2
}
return fmt.Errorf("log ingest retries exhausted")
}
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 4*time.Minute)
defer cancel()
runID := strconv.FormatInt(time.Now().UTC().UnixNano(), 10)
if err := ping(ctx, os.Getenv("HEARTBEAT_START_URL")); err != nil {
fmt.Fprintln(os.Stderr, err)
}
if err := mirrorLog(ctx, os.Getenv("INFRAI_START_LOG_JSON"), runID+"-start"); err != nil {
fmt.Fprintln(os.Stderr, err)
}
cmd := exec.CommandContext(ctx, os.Getenv("JOB_COMMAND"))
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
_ = ping(context.Background(), os.Getenv("HEARTBEAT_FAIL_URL"))
_ = mirrorLog(context.Background(), os.Getenv("INFRAI_FAIL_LOG_JSON"), runID+"-fail")
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
if err := ping(context.Background(), os.Getenv("HEARTBEAT_SUCCESS_URL")); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
if err := mirrorLog(context.Background(), os.Getenv("INFRAI_SUCCESS_LOG_JSON"), runID+"-success"); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
Set INFRAI_BASE_URL to the documented v1 API base in deployment configuration. The three INFRAI_*_LOG_JSON values must be JSON bodies validated against the live discovery schema; the example treats them as opaque input because the log-ingest fields are not declared in this article's verified material. Each process creates one run identifier, and each event derives an idempotency key from it, so an HTTP retry does not duplicate that event while the next scheduled process remains distinct.
The four-minute timeout belongs to this illustrative five-minute schedule; it is not a universal default. Capacity planning starts with the observed high percentile of legitimate runtimes, scheduler jitter, and dependency latency, then leaves enough room before the next period to avoid overlapping work. If a normal run can exceed its period, I move the work behind a queue, make the consumer idempotent, and heartbeat the orchestration boundary rather than pretending cron is a workload manager. That choice costs another moving part, but it prevents a slow notification batch from turning the next cron tick into concurrent duplicate delivery work, and that is a trade I will take before loosening a deadline until the alert has no operational meaning.
Deadlines need teeth.
3. Compare the signal, not the dashboard
Healthchecks, Cronitor, and Better Stack Heartbeats are the relevant first comparison because each is positioned around expected-job check-ins. Sentry belongs in the review for a different reason: its event grouping helps organize reported errors, but an error tracker still needs an event to arrive. Infrai is another adjacent option for retaining run events through REST, not a replacement for the missing-run clock.
| Option | Best role in this design | Signal-quality trade-off | Operational boundary |
|---|---|---|---|
| Healthchecks | Dedicated cron heartbeat | Direct late or missing check-in signal | Validate integrations, regions, and retention against your requirements |
| Cronitor | Dedicated job monitoring | Direct check-in signal with job-monitoring context | Confirm the alert path and grace semantics before rollout |
| Better Stack Heartbeats | Heartbeats tied to an incident workflow | Direct missing-heartbeat signal | Evaluate whether its on-call workflow matches the existing one |
| Sentry | Grouping failures that actually report an event | Stronger exception triage, no evidence from a totally silent run | Keep it beside, not instead of, the heartbeat |
| Infrai | Structured run-event storage over REST | Useful after-the-fact evidence, no native missed-run detection | You own polling and alerts; log search filters are not declared in discovery |
I would run a short failure-injection review before choosing: suppress one invocation, kill one worker after its start signal, delay one valid run past the proposed grace period, and produce two identical failures. The winner is the service that creates one actionable incident for each real SLO breach without paging on harmless jitter. A polished dashboard does not compensate for duplicate pages or a silent scheduler failure.
For teams choosing between US and EU handling, region and data-residency support is a gate to verify in each vendor's current documentation and contract, not a capability I would infer from a marketing page. The same applies to notification destinations. Reject an otherwise convenient heartbeat alternative if it cannot satisfy the service's data boundary or reach the existing on-call path.
There is also a buy-versus-build decision hiding here.
| Path | Build effort | On-call load | Lock-in | My decision rule |
|---|---|---|---|---|
| Dedicated heartbeat service | Low | Low to moderate | Check-in URL and alert workflow | Default for a small platform team |
| Poll logs and build rules | High | High | Query schema and custom notifier | Only when policy forbids an external heartbeat |
| Self-host a heartbeat service | Moderate | Moderate to high | Lower data-plane dependency | Use when control or residency outweighs maintenance |
That table is intentionally unfriendly to an internal polling service. Someone must operate its scheduler, state, retries, deduplication, notification routing, and escalation behavior; those components are exactly the monitoring path whose own failure must remain visible.
I changed my mind here.
4. Budget noise before you budget storage
For the hypothetical five-minute job, the theoretical capacity is 288 runs per day. Three events per successful run would produce 864 log records per job per day, before retries or per-recipient detail. That arithmetic is a sizing example, not a recommendation to emit all three events forever. A completion heartbeat plus one structured completion record may be enough for healthy runs, while failures deserve richer context.
Set the heartbeat grace period from runtime data rather than instinct. Then define a missed-run SLO and track two separate error-budget consumers: genuinely late or absent completions, and false alerts caused by a deadline that is too tight. The second number matters because repeated false pages train responders to distrust the first.
For fintech notifications, keep customer content and direct identifiers out of heartbeat URLs and labels. Logs create a longer governance obligation: Infrai has no per-user log deletion interface and no bulk export or subscription interface, while GDPR Article 17 establishes a right to erasure subject to its conditions and exceptions. If per-user deletion is a hard requirement, choose a log store with the needed deletion control or avoid placing user-linked data there. This is a product boundary, not a paperwork detail.
5. Know when this design is the wrong one
Heartbeat monitoring is a poor fit for an event-driven worker with no expected arrival schedule. Silence may be healthy. Monitor queue age, backlog, and end-to-end delivery objectives instead, while keeping failure events for diagnosis.
It is also incomplete when the main question is why a request crossed several services slowly. Log correlation fields can connect known records, but a trace query and span tree are the appropriate tools for that investigation. Likewise, teams needing source-map decoding, crash symbolication, Electron minidump parsing, or Session Replay should evaluate an error-monitoring product built for those jobs rather than stretching a heartbeat service or a basic log API into them.
My final gate is simple: can the monitor page when the scheduler emits absolutely nothing, and can the page identify one owner without exposing customer data? If yes, mirror compact run events into the logging system that best fits retention and deletion policy. If no, more instrumentation inside the job will not close the silent-failure gap.
Sources and References
- Healthchecks documentation: https://healthchecks.io/docs/
- Cronitor cron job monitoring documentation: https://cronitor.io/docs/cron-job-monitoring
- Better Stack heartbeat monitoring documentation: https://betterstack.com/docs/uptime/cron-and-heartbeat-monitoring/
- Sentry event grouping and fingerprint mechanics: https://docs.sentry.io/concepts/data-management/event-grouping/
- GDPR Article 17, right to erasure: https://gdpr-info.eu/art-17-gdpr/
Top comments (0)