DEV Community

dawn li
dawn li

Posted on

Error Tracking and Uptime Monitoring Retention (For Silent Import Failure)

A marketplace needs to know when scheduled imports stop producing results. Error tracking, uptime monitoring, and cron heartbeat checks create different evidence to retain; the observability bill consists of captured exceptions, retained diagnostic detail, checks, and notification delivery. Start with a completion heartbeat and a small record of the result that became visible. Retaining every imported item can dominate the evidence volume long before retaining one completion record per run does.

Short answer: Error tracking catches crashes and thrown exceptions; uptime monitoring checks whether a service responds; a cron heartbeat detects missing scheduled completion. For silent import failure, the least complex useful starting point is an independently checked completion deadline. Keep enough result evidence to distinguish a stopped importer from a legitimate empty import before using that signal to justify rollback.

Consider an illustrative workload, not a measured deployment: 100 scheduled imports per day, 10,000 item records per import, and a 30-day evidence window. Keeping one diagnostic record per item produces 30,000,000 records; keeping one completion record per run produces 3,000. Those are record counts, not equal-size bytes or a provider quote. The change that moves the dominant term is to summarize successful runs while retaining targeted failure detail.

Keep the boundary.

A smaller evidence set is useful only if it still tells you which catalog result was published and which previous result could be restored.

How do error tracking and uptime monitoring miss silent import failure?

An exception event means code reported a problem. It cannot establish that a scheduler launched the next job, because a job that never starts has no opportunity to throw an exception, and an empty error dashboard therefore says very little about whether yesterday's product inventory remains on sale. Error tracking alone is a reasonable starting point for exception visibility inside an application. Scheduled imports need another signal.

A successful uptime probe answers a different question: could the checked service respond at the time of the check? A responsive storefront can serve an old catalog. Probing that storefront does not demonstrate that the import schedule advanced.

A completion heartbeat should be emitted after the result is committed and made available to readers, with the exact boundary defined by the application. Sending it at process startup creates a specific failure mode: the job announces health, then fails before publishing anything, while the monitor continues to hold apparently reassuring evidence. A start signal can be useful diagnostically, but it is insufficient as a completion signal. Even completion has limits: a run can finish successfully with zero imported items, which might be correct for one marketplace feed and alarming for another. Record the expected schedule, the completed run identifier, its result count, and the identifier of the published result as an application-owned evidence design; these are proposed record contents, not a vendor API schema. For feeds expected to change, check freshness as well as process completion.

The missing event is evidence of a missed deadline, not proof of a bad release.

Spend retention on evidence that can authorize rollback

Use three signals with separate meanings: exceptions for code failure, an external check for a service response, and a completion deadline for absent work. A custom poller can implement the last role if a dedicated heartbeat service is unnecessary, but it must run independently of the importer it watches; putting both into the same stopped execution path recreates the silent failure.

For the illustrative workload, a completion summary retains the compact history of which run published which result. Detailed item diagnostics serve another purpose: explaining why individual records were rejected. Retaining them for every successful item multiplies volume without necessarily improving the answer to whether a release should be reversed, although deleting them does sacrifice the ability to inspect a particular transformation later. The arithmetic favors summarization; an audit requirement may override it.

Evidence retained Decision it supports What it cannot establish
Exception events Locate a reported code failure Whether an absent job ever started
Uptime probe results Establish the checked service responded Whether marketplace data advanced
Completion summaries Identify missed runs and published results Whether each transformed item was correct
Detailed import diagnostics Investigate individual rejected or changed items Whether reverting application code restores data
A deliberately retained previous result Provide a candidate data rollback target Whether that target is still valid for current readers

No retention duration is a durability guarantee.

Nor does retaining a run identifier mean that the corresponding catalog result remains available. The evidence record and the recoverable result need compatible retention policies, otherwise an apparently actionable rollback reference can point to data that has already been discarded. Before reversing a release, establish the last completed run, the currently visible result, and whether the candidate previous result remains compatible with the application. Restoring an older executable does not by itself undo data already published by an importer.

Compare the monitor against the question it answers

The useful comparison is evidence coverage and rollback boundaries, not a price ranking. These tools have overlapping features, so the table describes relevant roles rather than mutually exclusive product categories; a deployment still needs its schedule and result semantics configured explicitly.

Option Relevant role for scheduled imports Selection boundary
Sentry Application error tracking; its Cron Monitoring also addresses scheduled-job monitoring Exception capture alone does not prove scheduled completion; evaluate the scheduled-job feature separately
Healthchecks.io Check-ins and expected schedules for recurring jobs Put the success check-in after the application-defined completion boundary; it cannot define catalog correctness for you
Better Stack Uptime Uptime monitoring and heartbeat monitoring A reachable service and a completed import remain separate checks
Datadog Monitoring signals and alerting within a broader observability stack Decide which result signal to emit and maintain its application integration

Infrai offers one key and one bill through a simple, plain REST API, with no SDK to install. That reduces credential sprawl and invoice reconciliation, while the language-agnostic HTTP interface lets the delivery-to-log handoff below run without SDK dependencies in the import worker's Python environment. The consistent interface covers 295 routes across 20 modules. Public discovery supplies request schemas and runnable examples without authentication; consult those schemas before choosing the log record field.

Its error tracking is an exception-evidence component: pair it with a heartbeat service or custom polling for missing work, and keep notification decisions in the monitoring design. The limitation matters: error tracking alone cannot detect an import that never started. Choose Healthchecks.io for the completion-deadline role when a dedicated heartbeat service fits the team.

This is a capability boundary, not a reason to abandon error capture. Source-map decoding, crash symbolication, session replay, and a distributed span tree are separate evaluation criteria if investigating an importer requires them; do not infer their availability from the presence of an error event or a trace identifier.

Carry delivery evidence into the same diagnostic record

A deadline can trigger an operator notification, but accepting a notification request and observing its delivery are different facts. The useful cross-service seam is to retrieve SMS delivery events and ingest that returned evidence into the same logging destination used for application diagnostics. That makes delivery evidence available alongside the import evidence without treating delivery as proof that anyone investigated the incident.

A Twilio plus Datadog alternative introduces two service signups and two sets of service credentials for this seam. The application must carry the message identifier into its incident record, retrieve or receive delivery evidence, and translate it into the observability destination's record shape. Existing accounts can reduce setup work. They do not eliminate that glue.

The Python example copies delivery evidence for an existing SMS identifier into a log record, using the same configured key and versioned base URL for both requests. It does not send a second notification. Request fields for log ingestion must come from the public discovery schema: supply a valid record as LOG_INGEST_RECORD and set DELIVERY_EVENT_FIELD to an existing string field in that record. The script replaces that field with the serialized delivery response, so it invents no ingestion field names. Configuration also requires INFRAI_BASE_URL, INFRAI_API_KEY, SMS_ID, and a stable DELIVERY_RECORD_ID for this evidence write. Keep the last value unchanged when retrying the same write; choose a new value for a new evidence snapshot. This example uses only Python's standard library.

import json
import os
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.parse import quote
from urllib.request import Request, urlopen

base = os.environ["INFRAI_BASE_URL"].rstrip("/")
key = os.environ["INFRAI_API_KEY"]
if not base.startswith("https://") or not base.endswith("/v1"):
    raise ValueError("Use the documented HTTPS v1 base URL")


def request(method, path, payload=None, write_id=None):
    headers = {"Authorization": f"Bearer {key}"}
    body = None
    if payload is not None:
        headers["Content-Type"] = "application/json"
        body = json.dumps(payload).encode("utf-8")
    if write_id is not None:
        headers["Idempotency-Key"] = write_id
    for attempt in range(4):
        req = Request(base + path[len("/v1"):], data=body, headers=headers, method=method)
        try:
            with urlopen(req, timeout=30) as response:
                if not 200 <= response.status < 300:
                    raise RuntimeError(f"Unexpected HTTP {response.status}")
                return json.loads(response.read())
        except HTTPError as exc:
            detail = exc.read().decode("utf-8", errors="replace")
            if exc.code != 429 or attempt == 3:
                raise RuntimeError(f"HTTP {exc.code}: {detail}") from exc
            delay = float(2 ** attempt)
            retry_after = exc.headers.get("Retry-After")
            if retry_after:
                try:
                    requested = float(retry_after)
                except ValueError:
                    deadline = parsedate_to_datetime(retry_after)
                    requested = (deadline - datetime.now(timezone.utc)).total_seconds()
                delay = max(delay, requested)
            time.sleep(delay)


record = json.loads(os.environ["LOG_INGEST_RECORD"])
field = os.environ["DELIVERY_EVENT_FIELD"]
if not isinstance(record, dict) or not isinstance(record.get(field), str):
    raise ValueError("Select an existing schema-valid string field")
write_id = os.environ["DELIVERY_RECORD_ID"]
if not write_id:
    raise ValueError("A stable write identifier is required")
sms_id = quote(os.environ["SMS_ID"], safe="")
delivery = request("GET", f"/v1/sms/events/{sms_id}")
record[field] = json.dumps(delivery, separators=(",", ":"))
receipt = request("POST", "/v1/logs/ingest", record, write_id)
print(json.dumps(receipt))
Enter fullscreen mode Exit fullscreen mode

The copied object is delivery evidence, not an assumed response field or an invented delivery-status enumeration. Check the ingestion schema's field limits before using this whole-response form. For a production record, choose the smallest documented delivery fields that answer the incident question, and preserve the import's correlation identifier in the supplied record. The code reports HTTP error bodies and retries rate limits with backoff while honoring Retry-After; its write identifier remains constant across those retries.

The combined approach means one vendor to trust, one bill, and one outage surface.

An independent completion monitor still matters, especially if the service collecting evidence becomes unreachable. Sending an SMS is a notification action; it is not the missing-task detector.

Keep the rollback window and discard the rest deliberately

Start the retention decision from the time during which a release can still be reversed safely. Keep completion summaries and their referenced previous results through that decision window, with failure detail retained according to investigation and audit needs. Do not derive a universal duration from the illustrative 30-day calculation: inventory volatility, evidence obligations, and compatibility of older results determine whether that window is appropriate.

Stop keeping routine per-item success diagnostics when completion summaries and retained results answer the operational question. The cost is specific: after disposal, an operator may know which catalog result was published but be unable to reconstruct why one listing received a particular transformation. Keep detailed evidence longer where that loss is unacceptable.

A missed completion deadline should trigger investigation. Authorize rollback only when the evidence connects the release to the failure and identifies a usable previous result. Otherwise the monitor has found missing work, and reverting code may leave the marketplace serving exactly the same stale data.

References

These sources document the signal definitions, product scope, and delivery integration alternative.

Further reading

Top comments (0)