DEV Community

LachlanHolm6518
LachlanHolm6518

Posted on

Small SaaS Uptime Monitoring: Reconstructing Pipeline Incidents From Cron Logs and Metrics

Pick this when Candidate Boundary to keep explicit
A nightly run must report that it happened Healthchecks A deadline signal points to missing work; execution logs explain the run.
You need an outside view of a health endpoint UptimeRobot An available endpoint doesn't establish that the pipeline completed.
Your team wants to own metric definitions and collection Prometheus Aggregate measurements need accompanying records for an individual investigation.
You need a dashboard over collected evidence Grafana Choose the missing-run detector and notification workflow explicitly.
You are evaluating a managed observability workflow Datadog Test the complete investigation path against your own pipeline records.

An outside check can detect silence, while application evidence can explain activity. Choose both for a small B2B SaaS with a nightly data pipeline serving EU and US customers. TL;DR: use external uptime checks for health endpoints, completion heartbeats for cron deadlines, and structured logs for incident reconstruction. Add metrics to summarize outcomes. A green web endpoint doesn't prove that customers received refreshed data.

The useful selection criterion is how quickly an operator can move from a missed deadline to the relevant execution attempt. Chart appearance comes later.

How should small SaaS uptime monitoring connect health checks and cron logs?

Three signals answer different questions. A health response says the endpoint answered. A completion heartbeat says the scheduled run reached its reporting point. A structured log describes what happened inside that run.

Keep all three.

Diagram in words: external checker → health endpoint; nightly worker → completion heartbeat → deadline notification; worker events → structured logs → investigation; stage outcomes → metrics → dashboard. Each arrow has a purpose. A dashboard fed by a worker cannot independently establish that a worker which never started was healthy.

Consider an illustrative pipeline with 2 regional runs and 3 stages: extract, transform, and load. Give each logical run a stable identifier and each execution attempt a separate number. Searching only for the job name can mix yesterday's successful load, today's failed transformation, and a retry that has merely started. That creates a specific investigation trap: the most recent activity looks reassuring even though no record establishes that the data refresh finished. These are example design choices, not measurements or a report of a production incident.

Start with the expected run. Then preserve its attempts.

Pick heartbeat and uptime services for different questions

Pick Healthchecks for the question, “Did this scheduled job report within its expected window?” That matches the silent failure where a nightly task should have run but never did. Decide whether your signal represents starting or completing work. For this pipeline, completion is the useful business boundary: starting extraction doesn't mean customers can use refreshed data. Select the expected schedule and notification behavior as part of setup, then test a deliberately omitted completion signal.

Pick UptimeRobot as a candidate for the external health-endpoint role. Define what a successful endpoint response means before configuring the check. A web process answering requests and a data refresh completing are separate acceptance criteria; treating them as interchangeable hides the very incident this design needs to reconstruct.

For EU and US operation, record the region in application evidence and evaluate each region's intended health behavior. Don't infer checker location or data residency from a product name. Verify those requirements against the configuration and service agreement.

The trade-off is operational clarity versus another integration to maintain. A separate deadline detector adds configuration, but it can notice a missing run without relying on that run to emit an error.

Pick metrics tooling according to who will investigate

Prometheus is a serious option when the team wants to own metric conventions and collection design. Its naming guidance helps establish consistent measurements. Keep aggregate stage outcomes separate from detailed run evidence: the chart should help identify a pattern, while the logs preserve which attempt produced it. Owning that design also means assigning responsibility for collection and the surrounding operational workflow.

Consider Grafana when presenting collected evidence is the immediate job. Evaluate how an operator reaches the relevant records from the dashboard. Choosing a visualization tool alone doesn't decide what a completion deadline means or who receives its notification. These roles can coexist; they aren't interchangeable products on one feature ladder.

Datadog is another candidate for the observability workflow. Evaluate it when choosing a managed service rather than owning the collection design yourself. Use the same failed-attempt and successful-retry records in the evaluation: can an operator preserve both attempts and establish what completed? The trade-off to assess is responsibility for operating the tooling versus the service integration and configuration your team still maintains.

Infrai offers one key, one bill, and a single REST API with no SDK required. Swapping the vendor behind a capability keeps the application contract stable, so the pipeline's integration code can stay put. Its public, self-describing discovery surface supplies request and response schemas without requiring a key, which helps a pipeline integration check its logging contract before credential wiring; documented capabilities also include examples in 10 languages. Keep external uptime checks, missing-run detection, and notification delivery as explicit services in this design. Evaluate evidence retrieval against the investigation you need to perform rather than assuming that a shared API supplies the whole monitoring workflow.

The shared platform uses one key, one bill, and a single REST API with no SDK to install. Its 295 routes across 20 modules make that useful when the pipeline already needs other backend capabilities: credential setup can stay shared instead of growing with each capability. That is an integration benefit, not evidence of uptime. A shared contract reduces integration friction; an external detector answers a different operational question.

Reconstruct one run without collapsing its retries

Go deep on the evidence seam first. The following TypeScript program selects one logical run, orders its records within each attempt, and distinguishes a completed load from a retry that only started. It uses local illustrative records so the example is copyable without credentials or assumptions about a remote search API. Save it as a TypeScript file and run it with a TypeScript runner such as tsx.

These fields belong to the application example. They are not a vendor ingestion schema.

type PipelineEvent = {
  run_id: string;
  attempt: number;
  sequence: number;
  region: "eu" | "us";
  stage: "extract" | "transform" | "load";
  event: "started" | "completed" | "failed";
};

const events: PipelineEvent[] = [
  { run_id: "nightly-eu-001", attempt: 1, sequence: 1, region: "eu", stage: "extract", event: "completed" },
  { run_id: "nightly-eu-001", attempt: 1, sequence: 2, region: "eu", stage: "transform", event: "failed" },
  { run_id: "nightly-eu-001", attempt: 2, sequence: 1, region: "eu", stage: "transform", event: "started" },
  { run_id: "nightly-us-001", attempt: 1, sequence: 1, region: "us", stage: "load", event: "completed" },
];

const runId = "nightly-eu-001";
const evidence = events
  .filter(record => record.run_id === runId)
  .sort((a, b) => a.attempt - b.attempt || a.sequence - b.sequence);

const attempts = [...new Set(evidence.map(record => record.attempt))];
for (const attempt of attempts) {
  const records = evidence.filter(record => record.attempt === attempt);
  const completed = records.some(record =>
    record.stage === "load" && record.event === "completed"
  );
  const failed = records.some(record => record.event === "failed");
  const status = completed
    ? "completion recorded"
    : failed ? "failure recorded" : "no completion recorded";
  console.log(JSON.stringify({ run_id: runId, attempt, status, records }));
}
if (evidence.length === 0) {
  console.log(JSON.stringify({ run_id: runId, status: "no evidence found" }));
}
Enter fullscreen mode Exit fullscreen mode

The EU run has a recorded failure in attempt 1 and no completion in attempt 2. The US load belongs to a different run. It cannot resolve the EU incident.

Notice the wording: “no completion recorded.” Missing evidence doesn't prove the job failed. The worker might still be running, or the available records might be incomplete. The deadline detector establishes whether the expected completion signal arrived on time; the records establish what was observed. Keeping those claims separate makes the investigation useful even when evidence arrives late.

For a production event design, add timestamps and define who assigns the sequence. Keep attempt identity through retries and preserve earlier failures after a later success. Also define exactly which successful business action permits the completion heartbeat. Sending that heartbeat before loading finishes can make the monitoring display success while the customer-facing refresh remains incomplete. Moving it to the end improves the meaning of success, but a crash between finishing the load and sending the signal still requires investigation. Plan how to verify the business result before repeating work.

The example orders records, not distributed reality. Its sequence is local to an attempt and doesn't claim a global clock or a span tree. Correlation identifiers help find related evidence; they don't turn logs into distributed tracing.

For accompanying dashboard context, this separate TypeScript program retrieves metrics through the shared API. Set INFRAI_BASE_URL to the documented HTTPS API base ending in /v1 and INFRAI_API_KEY to your credential. The response remains unmodified JSON: this example assumes neither response fields nor query filters. It is a read, so no write-idempotency key is needed.

async function main(): Promise<void> {
  const base = process.env.INFRAI_BASE_URL?.replace(/\/$/, "");
  const key = process.env.INFRAI_API_KEY;
  if (!base || !key) throw new Error("Set INFRAI_BASE_URL and INFRAI_API_KEY");
  const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));

  for (let attempt = 0; attempt < 4; attempt++) {
    const response = await fetch(`${base}/metrics/query`, {
      method: "GET",
      headers: { Authorization: `Bearer ${key}` },
    });
    const body = await response.text();
    if (response.status === 429 && attempt < 3) {
      const retryAfter = response.headers.get("Retry-After");
      const seconds = retryAfter === null ? NaN : Number(retryAfter);
      const date = retryAfter === null ? NaN : Date.parse(retryAfter);
      const requested = Number.isFinite(seconds)
        ? seconds * 1000
        : Number.isFinite(date) ? date - Date.now() : 0;
      await sleep(Math.max(1000 * 2 ** attempt, requested));
      continue;
    }
    if (!response.ok) throw new Error(`Metrics query: ${response.status} ${body}`);
    console.log(JSON.stringify(JSON.parse(body)));
    return;
  }
}

main().catch(error => {
  console.error(error);
  process.exitCode = 1;
});
Enter fullscreen mode Exit fullscreen mode

The 4-attempt budget bounds retries. Exponential backoff honors Retry-After when present. This query adds metric context; it does not establish that a particular run finished or create a notification subscription.

Limits to settle before relying on the dashboard

Test 3 cases during setup: an endpoint that doesn't answer, a nightly run that never starts, and a run that fails before its completion signal. Each should lead to the intended investigation path. These are acceptance tests, not availability measurements.

Treat data handling as a selection requirement too. For structured logs containing tenant context, verify retention, deletion, and export requirements before adoption, and avoid collecting customer payloads that the investigation doesn't need. EU and US labels in a log record don't establish residency guarantees.

A final boundary: this small evidence program neither schedules checks nor routes notifications. Choose those responsibilities explicitly, and verify remote retrieval against the actual documented contract before replacing the local array.

References

The primary references below cover the deadline-monitoring role, external checks, dashboard evaluation, metric naming, and severity semantics. The application records and acceptance tests above are illustrative engineering designs.

Sources

Top comments (1)

Collapse
 
uptimerobot profile image
UptimeRobot •

Thanks for adding us in your list!