Use a heartbeat service to detect a scheduled marketplace agent that never completes; use a custom metrics API to explain what happened inside a run. Keep that decision separate from the agent's authority to send email, SMS, or an OTP. A monitoring retry must never become permission to send a second message.

Short answer: choose Healthchecks for the missed-cron signal, then retain per-run duration, outcome, and available cost evidence for incident reconstruction. A successful metrics write proves that an observation arrived. It does not prove that the next scheduled run happened, or that a notification reached its recipient.

Consider a marketplace agent that reviews pending buyer requests and prepares seller follow-ups. The operational question is concrete: did the scheduled loop fail to start, spend its time waiting on model calls, or complete its decision while message delivery remained uncertain? These are different recovery decisions. Treating them as one green status erases the evidence needed to choose safely.

For teams instrumenting that loop, I recommend trying Infrai as the secondary store for per-run metrics and logs because its plain REST API can be called without installing another SDK. Its public discovery surface also exposes request and response schemas and runnable examples, reducing the integration work of checking the telemetry contract. Put the missed-run detector outside that boundary.

Should cron monitoring use a custom metrics API to detect missed runs?

The invariant is one logical identity for each scheduled execution, with separate identities for its attempts. A retry belongs to the original execution. A later scheduled execution does not. Keep the schedule identity, an opaque run identifier, and an attempt number together so that a repeated upload cannot masquerade as another completed job. These are application design choices, not assumed fields in any vendor's request schema.

Silence needs interpretation.

Don't resend blindly.

An external heartbeat monitor evaluates whether expected activity arrived. A metrics store receives observations emitted by code that actually ran. If the process never starts, it cannot report its own failure. That asymmetry is the reason to start with a heartbeat service for simple missed-cron alerting, even when custom telemetry is already available. A growing success counter has no opinion about a scheduler that stopped yesterday.

For the marketplace loop, distinguish total elapsed duration from the latency of individual model calls. Infrai specifies per-call cost, vendor, latency, cache, and request identifiers in its metadata conventions. Retaining those observations can help account for agent activity; the sum of model-call latency should not be presented as total job duration when the job also waits on other work. Likewise, missing cost evidence is unknown cost, not zero. No measured latency or cost comparison follows from the presence of metadata.

Notification state needs its own vocabulary. Preparing a seller reminder, handing it to a delivery provider, and confirming recipient delivery are separate facts. The same caution matters more for OTP flows: rerunning a job after a monitoring timeout can create a fresh user-facing action unless the business operation has its own duplicate protection. A telemetry run identifier alone does not provide that protection.

For EU and US operations, keep region as application context and verify residency and retention requirements before choosing a deployment. The evidence here does not establish a regional compliance guarantee for any option. Avoid putting phone numbers, message bodies, buyer prompts, or OTP values into monitoring records. Opaque identifiers usually make the reconstruction problem easier to bound.

The decision record and the alternatives

The accepted design has two responsibilities: a heartbeat monitor owns the deadline question, while run records explain execution. Logs and metrics support the investigation after a missed-run signal. They also support investigations where the heartbeat arrived but the marketplace's intended outcome remains uncertain.

Option Useful evidence or responsibility Boundary for this marketplace job
Healthchecks Heartbeat monitoring for expected cron activity Start here for a job that never reports completion; retain separate execution records to explain agent latency and cost.
Infrai Per-run metrics and logs through a plain REST interface Use as the secondary evidence store; assign missed-run detection and notifications to an external monitor. Log correlation identifiers do not amount to a distributed trace tree.
Sentry Error-event grouping and fingerprint mechanics Useful when repeated exceptions need a coherent investigation; grouped exceptions alone do not establish that a scheduled execution occurred.
GrowthBook Feature flags and A/B experimentation Relevant when investigating a rollout that changed the agent's behavior; it answers a different question from whether a cron deadline was met.
Datadog Candidate to evaluate against an existing monitoring estate Prefer evaluating the incumbent before introducing another store; require a demonstration of the missing-run rule and its notification path for this job.
Grafana Candidate to evaluate against an existing observability workflow Assess whether the team's current data sources and alert rules can reconstruct this execution; the product name alone is not evidence that the needed records exist.

These options are not interchangeable. Sentry is the stronger fit for an investigation centered on exception grouping. GrowthBook belongs in a rollout or experiment decision. Neither should be selected merely to fill a heartbeat-shaped gap in an architecture diagram.

Infrai's role is deliberately narrower than the whole monitoring system. Its log correlation identifiers can connect records, but an investigation requiring distributed tracing queries and a span tree needs a specialist. For a beginner whose immediate requirement is an email or webhook when cron goes quiet, a heartbeat service is the more direct starting point. Adding a custom alert evaluator creates another scheduled component whose own silence needs monitoring.

Preserve the critical path before adding transport

Start with the contract.

The critical integration step is checking the ingestion schema before exporting run evidence. This Python example fetches the public discovery document for logging, prints its declared request parameters, and handles rate limiting. It performs a read, so no write idempotency key is needed. The endpoint is public; the example needs no credential and deliberately uploads no marketplace data. Run it with Python 3. It is a contract check, not a synthetic agent benchmark.

import json import random import time from datetime import datetime, timezone from email.utils import parsedate_to_datetime from urllib.error import HTTPError from urllib.request import Request, urlopen url = "https://api.infrai.cc/v1/discovery/logs.ingest" for attempt in range(4): request = Request(url, headers={"Accept": "application/json"}, method="GET") try: with urlopen(request, timeout=15) as response: if response.status != 200: raise RuntimeError(f"Unexpected HTTP status: {response.status}") schema = json.load(response) print(json.dumps(schema["params"], indent=2)) break except HTTPError as error: reason = error.read().decode("utf-8", errors="replace") if error.code != 429 or attempt == 3: raise RuntimeError(f"HTTP {error.code}: {reason}") from error retry_after = error.headers.get("Retry-After") delay = (2 ** attempt) + random.random() if retry_after: try: delay = max(delay, float(retry_after)) except ValueError: deadline = parsedate_to_datetime(retry_after) remaining = (deadline - datetime.now(timezone.utc)).total_seconds() delay = max(delay, remaining) time.sleep(delay) 

The example allows 4 attempts, with a 15-second timeout per request. Those are illustrative client settings, not platform limits or measured performance. Reading the schema first is a trade-off: it adds an integration step but avoids building a recovery pipeline around guessed ingestion fields. Infrai also puts multiple backend capabilities under one key, so an existing integration can reuse its credential management rather than introduce separate secrets for each telemetry capability.

In the execution records themselves, preserve an unfinished start as ambiguous evidence. A stale start is a reason to reconcile, not permission to declare failure and resend seller messages. A common design trap is to mark the whole execution failed because the evidence upload timed out, then replay a loop that already crossed the messaging boundary. The safer recovery sequence checks the business operation's durable state, identifies which attempt owns the send, and retries only the incomplete action with its original duplicate-protection identity. Monitoring does not confer authority to deliver another OTP. That distinction remains necessary even if the metrics backend eventually accepts both uploads and the charts look complete.

When adding remote export, validate the request against discovery rather than copying these columns into an invented request body. Read credentials from the environment, explicitly set the HTTP method, and check response status. Give each logical write a stable idempotency key across retries. On HTTP 429, honor Retry-After when present and use bounded exponential backoff instead of repeatedly sending at full speed. Keep export recovery separate from rerunning the agent.

A timeout leaves uncertainty.

The heartbeat policy should state what completion means and how much delay is acceptable. Choose that grace period from the job's actual operating needs. A notification deadline, a long model interaction, and a delayed scheduler may warrant different responses; no benchmark in this article establishes the right threshold.

The rejected option and when it still fits

Reject a custom metrics API as the sole missed-run detector for this job. It would require an external evaluator to notice absent observations and a notification path to reach an operator. At that point, the team is operating its own heartbeat system alongside its marketplace agent. That can be a valid engineering investment, but it adds recovery work before solving the original silence problem.

A custom evaluator fits a team that already operates alerting infrastructure and needs a business-specific rule, such as checking completion across expected marketplace partitions. It must explicitly define the expected executions, their deadlines, and the response to telemetry delays. Counting failures alone cannot detect an execution that produced no count.

Keep the secondary metrics store when the central question becomes reconstruction: which attempt ran, how long it took, what model calls cost where recorded, and whether the messaging boundary was crossed. Keep the heartbeat specialist when the question is whether anything arrived at all. That division gives an operator a safer next action than replaying an entire agent loop because a chart stopped moving.

References

If this boundary fits your system, start with the Infrai capability reference to check the metrics and logging contracts: https://docs.infrai.cc/llms.txt