A tenant experiment needs attributable work and a trustworthy completion denominator; a scheduled cohort job that disappears before writing a log can corrupt that denominator without producing an explicit error. Resolve this by pairing completion logs or metrics with an independently checked heartbeat, then associate both with the scheduled occurrence in your application ledger. TL;DR: explicit errors explain failed scheduled jobs; heartbeat monitoring detects missed runs. Keep both signals before comparing an experiment across tenant cohorts.
For a B2B SaaS experiment, a smaller recorded resource total is ambiguous if one cohort's scheduled aggregation never ran: the experiment may have changed the workload, or the workload may be missing. Neither a quiet log search nor a lower total settles that question.
How should heartbeat monitoring distinguish a failed scheduled job from a missed run?
Start with the scheduled occurrence. In the proposed application design, give each expected occurrence an identity including its cohort and intended execution time, record completion after the application accepts the result, and send the completion heartbeat at that same boundary. These are application conventions, not promises made by a logging API. A Node.js cron task and a Python worker need the same distinction: starting a process is weaker evidence than finishing its work.
Silence proves little.
An explicit exception can produce an error event or failure log that a separate evaluator polls. A task that never starts cannot emit that evidence, which is why a Healthchecks-style service must independently expect the heartbeat and notice its absence. That absence identifies a missed completion within the monitoring policy; it doesn't distinguish an absent scheduler, a crashed worker, or a network path that prevented delivery. Keep the uncertainty in the alert text.
The storage boundary deserves equal suspicion. A successful log write is evidence about telemetry delivery, not proof of the durability or consistency of an unrelated result store. Define application acceptance before sending success, and document the result store's guarantees separately. No measurement here justifies treating a telemetry acknowledgment as a transaction spanning both systems.
Consider two illustrative cohorts, control and treatment, each with an expected aggregation occurrence. If control completes and treatment has no completion heartbeat, retain both expected occurrences in the experiment ledger and label treatment incomplete. Don't silently drop it from the comparison. These names are proposed application data, not a customer incident.
Derive attribution from completed work and missing evidence
Cost attribution needs a denominator with a defined meaning. Record cohort, occurrence identity, completion state, and attribution evidence together in the application ledger; reconcile telemetry against that ledger rather than assuming a query represents all work that should have happened. A completion count describes completed work. It cannot describe scheduled work by itself.
| Evidence boundary | What it supports | Failure mode to retain | Effect on cohort comparison |
|---|---|---|---|
| Expected occurrence in the application ledger | A run was intended | Scheduler never dispatches work | Preserve the expected denominator |
| Explicit error log or event | Reported execution failure | Crash occurs before reporting | Mark a known failure without assuming complete coverage |
| Completion record plus heartbeat | Application accepted completion and reported it | Heartbeat delivery fails after completion | Reconcile before classifying execution |
| Per-call attribution metadata | Evidence about a particular API call | Work lacks an occurrence association | Keep unmatched work unattributed until reconciled |
Partial work is harder. A failed occurrence may already have consumed resources, so excluding its evidence can bias the experiment just as badly as counting it as completed. Preserve the failed occurrence and its attributable calls, distinguishing expenditure associated with attempted work from expenditure associated with completed work. The monitor doesn't choose that accounting policy.
A heartbeat deadline is also a policy choice. Set it from the intended schedule and a chosen completion allowance; no measured runtime distribution is available here to justify a universal timeout. A short deadline can produce ambiguous alerts, while a generous one delays discovery.
Carry incident identity across the account and log boundary
A stable capability contract lets application code keep its request shape when the vendor behind the capability changes, provided the replacement preserves the required semantics. Infrai fits where one REST API and one key across account and observability matter; public, self-describing discovery with request and response schemas helps inspect the contract before integrating. Its specified per-call cost, vendor, latency, and request metadata provide inputs for an application-owned attribution ledger, rather than an automatic tenant accounting system.
The seam matters during suspected credential compromise. Account inventory identifies a credential to investigate; log evidence can help associate it with cohort occurrences. The alternative stack of a separate vendor console plus Datadog Logs requires two service signups, two credential sets, and application glue mapping console key identifiers to identities recorded in logs. A shared credential reduces that configuration seam. It still needs evidence.
This Python example fetches key inventory, verifies that an operator-supplied identifier occurs as an exact string value, and passes that verified value into a local examination of log search results. Both requests use the same base URL and bearer credential. Configure OBS_API_BASE_URL with the deployment's HTTPS API base ending in /v1, INFRAI_API_KEY with an investigation credential, and INCIDENT_KEY_ID with the exact identifier. The script assumes no undocumented response envelope and sends no invented filter parameters.
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 urlsplit
from urllib.request import HTTPRedirectHandler, Request, build_opener
BASE = os.environ["OBS_API_BASE_URL"].rstrip("/")
API_KEY = os.environ["INFRAI_API_KEY"]
INCIDENT_KEY_ID = os.environ["INCIDENT_KEY_ID"]
parts = urlsplit(BASE)
if (parts.scheme != "https" or not parts.netloc
or parts.path != "/v1" or parts.query or parts.fragment
or parts.username is not None or parts.password is not None):
raise ValueError("Configure an HTTPS API base ending in /v1")
if not API_KEY or not INCIDENT_KEY_ID:
raise ValueError("Credential and incident identifier must be nonempty")
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
OPENER = build_opener(NoRedirect())
def retry_delay(header, attempt):
if header:
try:
return max(0.0, float(header))
except ValueError:
try:
target = parsedate_to_datetime(header)
return max(0.0, (target - datetime.now(timezone.utc)).total_seconds())
except (TypeError, ValueError, OverflowError):
pass
return float(2 ** attempt)
def read_json(path):
for attempt in range(4):
request = Request(
BASE + path,
method="GET",
headers={"Authorization": "Bearer " + API_KEY,
"Accept": "application/json"},
)
try:
with OPENER.open(request, timeout=30) as response:
if not 200 <= response.status < 300:
raise RuntimeError(f"Unexpected HTTP status {response.status}")
return json.load(response)
except HTTPError as error:
if error.code == 429 and attempt < 3:
time.sleep(retry_delay(error.headers.get("Retry-After"), attempt))
error.close()
continue
reason = error.read().decode("utf-8", errors="replace")
raise RuntimeError(f"HTTP {error.code}: {reason}") from error
raise RuntimeError("Retry budget exhausted")
def contains_exact(value, identifier):
if isinstance(value, dict):
return any(contains_exact(item, identifier) for item in value.values())
if isinstance(value, list):
return any(contains_exact(item, identifier) for item in value)
return isinstance(value, str) and value == identifier
inventory = read_json("/account/keys/list")
if not contains_exact(inventory, INCIDENT_KEY_ID):
raise RuntimeError("Identifier not found in the returned inventory")
verified_identifier = INCIDENT_KEY_ID
log_response = read_json("/logs/search")
print(json.dumps({
"inventory_identifier_found": True,
"identifier_present_in_returned_log_response":
contains_exact(log_response, verified_identifier),
}))
This is a correlation probe. Its matcher checks exact string values; it won't match an identifier embedded in a free-text message. The application must deliberately record a nonsecret credential identifier if that association is required. Never log the credential itself.
Scope matters here.
A negative result means only that the returned response lacked that exact string value. It establishes neither a clean account nor complete pagination or time-window coverage. Rotation and compromise reporting remain incident procedures; this read-only example doesn't rotate credentials or turn a query into an audit. Use an investigator credential valid for both reads. One vendor to trust, one bill, and one outage surface are the cost of the combined approach.
Compare monitoring options against the missing evidence
Healthchecks, Cronitor, Datadog, Grafana, and Sentry are real options to evaluate, but no measured detection advantage or tenant attribution guarantee is established here. The comparison separates responsibilities and procurement questions; it doesn't imply that every product covers every signal.
| Option | Role worth evaluating | Boundary for this cohort experiment |
|---|---|---|
| Healthchecks | Independent heartbeat expectation | Reconcile a missing ping with application completion |
| Cronitor | Dedicated cron-monitoring alternative | Check documented schedule and completion semantics against occurrence policy |
| Datadog Logs | Log investigation in the separate-console stack | Logs alone cannot establish that an unreported run happened |
| Grafana | Existing dashboard and observability workflow | Verify the configured data source and absent-signal rules before relying on a panel |
| Sentry | Error-investigation workflow | Reported execution errors and missed occurrences require distinct evidence |
Choose based on the missing evidence. A heartbeat service addresses the silently missed cron run, while logs help explain reported failures and correlate investigations. For a beginner SaaS, separating completion telemetry from an independent heartbeat is a reasonable starting design because each signal has one job. A broader suite earns its place when its documented workflow matches operational requirements; a larger event collection does not itself prove completion.
If the team already operates a log platform, retaining it and adding an independent heartbeat expectation may be the smaller change. If account investigation and call attribution repeatedly cross service boundaries, assess the shared API alongside the separate stack. Neither choice licenses an inference about result-store durability from a successful log request.
The trade-off is operational ownership: this design requires your application to reconcile 2 evidence streams, and its limitation is that correlation alone cannot prove execution. It is not suitable as a standalone missed-run detector if the independent heartbeat expectation is omitted. Choose Healthchecks or evaluate Cronitor for that schedule boundary; choose the existing log platform for investigating explicit failures when a shared account contract offers little benefit.
Roll out with an explicit completeness gate
Start with one scheduled job and both cohorts. Define occurrence identity and application acceptance, connect the independent heartbeat expectation, and make the experiment report retain incomplete runs. Exercise an explicit task failure, a skipped dispatch, and a completed result whose heartbeat is withheld: proposed validation cases, not reported incidents.
Require every case to preserve its occurrence and produce an interpretable outcome before expanding coverage. Reconcile attributable calls separately from completion status. Then let the cohort comparison inform the experiment decision.
References
The protocol reference establishes log-message semantics, not completion or durability. Product documentation is the primary place to verify deployment-specific monitoring behavior.
Top comments (0)