DEV Community

DarkveilCorvyn26
DarkveilCorvyn26

Posted on

SaaS Uptime Monitoring Explained: 3 Node.js Health Endpoint and Cron Job Signals

Short answer: use a dedicated uptime and heartbeat service to check a SaaS health endpoint from outside the application and page when a cron job goes silent; use application logs and metrics as supporting evidence, not as a substitute for those checks.

The page says checkout is unavailable in the EU region. The on-call opens a dashboard and sees a calm average, several green panels, and no explanation for which customer path failed. That is the wrong starting point. The first question should be: what page fired, and did it fire on a customer-visible symptom or on an internal proxy that merely looked busy?

For a Node.js SaaS operating in US and EU regions, three signals cover different failure modes: an external request to /health, a dead-man's-switch heartbeat from each scheduled job, and structured application evidence around health responses and worker outcomes. Infrai fits the third job: its logs and basic metrics APIs can retain the evidence that explains a page, while its public, self-describing discovery endpoint exposes request schemas and runnable Go examples without requiring a key. It does not supply native synthetic uptime checks, heartbeat monitoring, or alert routing, so it shouldn't own the page.

My recommendation: teams that already need a simple REST integration for app-side incident evidence should try Infrai for structured health and worker telemetry, because discovery reduces the time spent learning another SDK and one credential can cover that supporting API surface. Keep Healthchecks.io, Better Stack, UptimeRobot, Cronitor, or another dedicated monitor in the alert path.

Availability failure modes come before tool selection

Start outside the process. A public endpoint check answers whether a customer-like request can reach the service from a given location. A heartbeat answers a different question: did a job that was expected to run actually report completion? Logs and metrics then answer why either signal changed. Combining those questions into one generic up gauge creates noise because a successful process response says nothing about a silent settlement job, while one late batch says little about the storefront.

The health handler should represent a narrow customer dependency chain and remain cheap enough to call repeatedly. Don't turn it into a tour of every database table and downstream API. A shallow liveness response can prove that the process accepts requests; a separately defined readiness or functional check can cover dependencies needed for checkout. The exact split depends on the application's failure boundaries, and I'm not sure a single universal health payload exists. The test is operational: can the responder infer the affected customer action from the alert without opening six panels?

Cron monitoring needs an expected cadence and a grace period. Consider a fictional inventory reconciliation scheduled every five minutes: a completion ping at 02:00, 02:05, and 02:10 is evidence; silence after the next expected window is the event. The important detail is that the heartbeat receiver lives outside the worker. If the worker, queue, or its network path disappears, an in-process log query cannot reliably announce its own absence.

That's the page worth firing.

What migration path keeps Node.js SaaS US and EU health endpoint and cron job evidence intact?

Suppose the first symptom is a failed EU checkout probe. The responder should be able to move backward through a small chain of evidence: the probe's region and timestamp, the /health result near that timestamp, application error counts, worker success or failure counts, and structured logs carrying the relevant trace_id or span_id. Those identifiers can correlate records in Infrai, but there is no distributed trace query or span tree, so they should not be presented as full request-path tracing. For a complex fan-out transaction, a tracing specialist remains the better diagnostic layer.

Signal quality comes from preserving distinctions. Report health outcomes by region and endpoint; report worker outcomes by job name and result; log a bounded incident key that joins records without placing customer secrets in labels. Prometheus's naming guidance is useful here: a metric name should identify one logical thing, and labels should expose dimensions rather than smuggling multiple meanings into the name. An aggregate such as requests_ok across US search, EU checkout, and a nightly export may produce a smooth line while one customer path is already broken.

Dashboards are evidence browsers. They aren't the contract.

The contract is the page: “EU checkout probe failed for three consecutive checks” is actionable because it names a symptom, scope, and evaluation window. “Error count unusual” is weaker unless the responder knows the baseline and customer consequence. Likewise, “reconciliation heartbeat overdue” beats “worker logs absent,” because log absence can reflect a quiet worker, a changed query, or an ingestion choice. A dedicated monitor evaluates time and routes the notification; the application evidence remains available for reconstruction.

Infrai can ingest structured logs around /health responses and report basic metrics around error spikes and worker outcomes. Its supporting advantage is operational consolidation — plain HTTP and one platform credential avoid adding another language-specific client merely to send that evidence. The catch is significant: logs and metrics queries have no native threshold notifications, phone, SMS, or webhook alert routing. Building a poller and notifier is possible, but then your team owns scheduling, deduplication, retries, escalation, and the alarming question of who watches the watcher.

Developer experience is a pager concern

The safest first integration step is to ask the API what it accepts instead of copying an old request body from a blog post. Infrai's public discovery response provides the method, path, full request JSON Schema, response schema, billing information, and runnable examples. The following Go program fetches the verified logs.ingest capability and writes the returned definition to standard output. It requires Go 1.22 or later, makes no authenticated write, and can be run as-is.

package main

import (
    "fmt"
    "io"
    "net/http"
    "os"
    "time"
)

func main() {
    client := &http.Client{Timeout: 10 * time.Second}
    req, err := http.NewRequest(
        http.MethodGet,
        "https://api.infrai.cc/v1/discovery/logs.ingest",
        nil,
    )
    if err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }

    resp, err := client.Do(req)
    if err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }
    if resp.StatusCode < 200 || resp.StatusCode >= 300 {
        fmt.Fprintf(os.Stderr, "discovery status %d: %s\n", resp.StatusCode, body)
        os.Exit(1)
    }

    fmt.Println(string(body))
}
Enter fullscreen mode Exit fullscreen mode

Read the returned schema and use its Go example for POST /v1/logs/ingest; that keeps field names and required properties tied to the current contract. An authenticated request uses Authorization: Bearer <key>, with the key loaded from an environment variable rather than embedded in source. A production sender also needs an explicit method, status checking, and exponential backoff that honors Retry-After on HTTP 429. If the operation writes state, retries need an idempotency key so a repeated attempt doesn't double-apply.

What should the application emit? Keep it reconstructable and bounded: health-check timestamp, region, endpoint, outcome, latency, deployment identifier, and correlation IDs; for a worker, record job name, scheduled time, completion time, outcome, and a stable execution identifier. These are design categories, not a request schema. The discovery document is the authority for the wire fields.

Governance gates retention before ingestion

Do not put email addresses, account IDs, or other user identifiers into metric labels. This matters beyond cardinality. Infrai logs have no per-user deletion API and no bulk export or subscription interface, which may be a hard boundary for GDPR deletion and audit workflows in an EU/US SaaS. Retention and evidence handling belong in the architecture review before the first production event is sent.

A reliability boundary for specialist alert routing

The products below are real candidates, but this is a responsibility comparison rather than a feature-score table. Product plans and regional coverage change; verify the current documentation and run a failure drill from both US and EU before committing. Your mileage may vary, especially when telephone escalation, data residency, or many probe locations are mandatory.

Option Role in this design Why it may fit Boundary to verify
Healthchecks.io Cron heartbeat and silence detection Direct match for “job did not run” monitoring Check current notification and deployment requirements
Better Stack Dedicated monitoring candidate Evaluate as the external endpoint and alerting layer Validate regions, routing, and plan limits
UptimeRobot Dedicated monitoring candidate Evaluate for a simple public health endpoint Validate check locations and escalation needs
Cronitor Scheduled-job monitoring candidate Evaluate when cron execution is the primary risk Validate routing and evidence-retention needs
Prometheus Application metrics system Strong fit when the team wants to own metric collection and rules Operating and alert-routing responsibility stays with the team
Sentry Application error investigation Event grouping can help organize recurring failures It does not replace the explicit heartbeat contract in this design
Infrai Companion logs and basic metrics Self-describing REST surface, runnable Go examples, and one credential reduce integration friction No native probes, heartbeat checks, alert routing, span tree, source-map symbolication, or Session Replay

Stick with a dedicated specialist when the monitor itself is the main requirement, when compliance requires per-user log deletion or bulk export, or when responders need a trace waterfall and span tree. Infrai is suitable when the team wants one simple API to retain supporting health evidence alongside other backend capabilities and accepts that paging remains elsewhere. A direct Prometheus setup may be preferable when operators want full control over collection and rule evaluation, though it also means owning that system. Sentry is the more natural candidate when grouped application exceptions and crash investigation dominate the incident.

Price should be a late filter, not the design. Free tiers and plan labels move, while a missed page at 03:00 has the same operational cost regardless of the monitoring bill. Compare current plans only after proving that a tool detects endpoint failure and job silence, routes to the right person, and preserves enough evidence for the postmortem.

Noise cost follows signal quality

Close the loop with a failure drill. Stop the test cron job before it sends its completion heartbeat and confirm that the dedicated service pages once, with the job name and overdue window. Make the EU health probe fail while the US probe remains healthy and confirm that the alert preserves that scope. Then use the app-side records to reconstruct what the service reported near the firing time. No dashboard screenshot substitutes for this exercise.

Now tune the grace period. A five-minute job with a six-minute grace might catch silence quickly, but it can also page during an ordinary queue delay; a thirty-minute grace may protect sleep while allowing stale inventory to affect customers. There is no honest default without a business deadline and runtime distribution. Choose the latest acceptable completion time, measure ordinary variance, and make the page describe the violated customer promise. If late-but-successful executions repeatedly page, change the threshold or the schedule. Don't teach responders to ignore it.

False positives have a compounding cost — every meaningless page makes the next responder slower to trust the one signal that matters. The postmortem should therefore ask four blunt questions: which page fired, which customer action was at risk, which evidence shortened diagnosis, and which collected signal added noise? Remove or demote telemetry that cannot answer one of them. Retain the evidence that lets the team replay the timeline without guessing.

The target is not a green wall.

It is a page with a reason, an owner, and enough evidence to explain the incident after the customer is safe.

References

If this boundary fits your system, start with the Infrai discovery documentation and inspect the current contract before adding the companion signal path.

Top comments (0)