A commerce platform needs customers to point their own domains at the product without turning every onboarding change into permanent DNS administration. The least complex starting point is to leave the customer's zone with its owner and monitor sending domain health on a daily schedule. The operating bill includes scheduled reads, metric reporting, evidence storage, and the work of resolving disagreements.
TL;DR: Read the sending domain's mail-service status and its published records on a schedule, emit both as metrics, and alert when they disagree. Keep an explicit list of active customer domains. Make zone ownership a separate decision: monitoring a customer's records does not require taking custody of their entire zone.
Quantify the recurring work before changing the architecture. In an illustrative inventory of 300 active sending domains, two reads per domain produce 600 reads per daily sweep, or 18,000 over 30 days. Running that same inventory hourly produces 432,000 reads over 30 days. These are workload calculations, not vendor prices or measured results. With this two-read design, scheduled reads outnumber the 9,000 daily paired results generated over 30 days; payload size and operator time still determine the actual bill. A daily run is enough for configuration that should not change on its own; that frequency changes the scheduled-read term by a factor of 24.
Keep ownership explicit.
How should we monitor sending domain health across customer-owned zones?
The storefront domain and the sending domain belong in the same onboarding inventory, but their checks answer different questions. A customer pointing a domain at the commerce product needs the intended web destination. A sending-domain check needs agreement between the published mail configuration and the mail service's view. Treating either result as proof of the other creates an avoidable blind spot.
Start with customer-owned zones when customers need to retain authority over unrelated records. The platform records what its sending configuration expects and monitors that configuration. It doesn't need to become the administrator of every record merely to detect drift. The trade-off is operational: a customer may edit a record by hand, while your team must explain the discrepancy and coordinate the correction.
Platform-owned zones are a reasonable choice when the service is supposed to administer that DNS lifecycle. They place record changes and monitoring under one operational owner, but they also put responsibility for changes within the scope of whatever authority the customer delegates. Decide that boundary during onboarding. A billing preference should not quietly become an authority decision.
For a concrete inventory, use the illustrative tenant domain receipts.shop.example with an explicit active flag and a declared zone owner. Those are application fields, not a provider response schema. Retiring that tenant should change the inventory first; otherwise an empty result can masquerade as a production incident. Keep the inventory limited to the domains and authority needed for this check, and assign someone responsibility for approving retirement.
Absence needs context.
Count observations, then decide what deserves a page
A mail service reporting a configured sending domain is one observation. Published DNS records matching the intended configuration are another. Emit both. Their agreement is the configuration-health signal; either observation alone can give an incomplete picture.
Agreement has limits. If both observations are negative, they agree about a bad configuration. That still deserves a visible health metric and an onboarding or repair workflow. A disagreement alert has a narrower purpose: it identifies a split between what DNS says and what the mail service believes. Neither agreement nor successful authentication establishes inbox placement, OTP arrival, or freedom from spam filtering.
That distinction matters in a commerce backend. A receipt or authentication message can depend on a correctly configured sender, but this monitor isn't a delivery receipt. Keep configuration health separate from delivery outcomes so an operator can tell which evidence an alert actually contains. DMARC provides an authentication-policy context for this work; it does not make a DNS configuration check an end-to-end delivery test.
For the 300-domain example, retaining one compact result per domain per day creates 9,000 results over 30 days. Keeping both raw observations for every check creates 18,000 observation snapshots in that interval, before accounting for their size. These counts describe an example retention policy, not a storage quota. The point is to choose what remains useful: a daily pair of metrics shows slow drift, while a snapshot associated with a disagreement helps explain what changed.
A record edited by hand last month is exactly the kind of drift this history should expose. Continually collecting the same healthy payload adds evidence volume without necessarily adding a useful decision.
A small reconciliation function keeps the policy inspectable
The following Python program uses the standard library. Set INFRAI_API_KEY, INFRAI_BASE_URL to the documented production API base including its version prefix, and SENDING_DOMAIN to a domain you administer. It reads the mail-service observation with an explicit GET, surfaces HTTP errors, and retries a rate-limited read with exponential backoff while honoring Retry-After. The read has no write side effects.
Four local fixtures then exercise the reconciliation policy: a healthy domain, a disagreement, a retired domain, and an incomplete observation. The booleans are normalized application inputs, not provider response fields. The program prints the mail response without guessing its schema; a production collector must also obtain the published records and map both documented observations. Unknown is distinct from false. A failed collection must not silently become a negative DNS result.
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
def read_mail_status(domain):
base = os.environ["INFRAI_BASE_URL"].rstrip("/")
url = base + "/email/domain/get/" + quote(domain, safe="")
for attempt in range(3):
request = Request(
url,
headers={
"Authorization": "Bearer " + os.environ["INFRAI_API_KEY"]
},
method="GET",
)
try:
with urlopen(request, timeout=20) as response:
if response.status != 200:
raise RuntimeError(f"Unexpected HTTP {response.status}")
return json.load(response)
except HTTPError as error:
status = error.code
retry_after = error.headers.get("Retry-After")
detail = error.read().decode("utf-8", errors="replace")
error.close()
if status != 429 or attempt == 2:
raise RuntimeError(f"HTTP {status}: {detail}") from error
delay = float(2 ** attempt)
if retry_after:
try:
delay = max(delay, float(retry_after))
except ValueError:
retry_at = parsedate_to_datetime(retry_after)
seconds = (
retry_at - datetime.now(timezone.utc)
).total_seconds()
delay = max(delay, seconds)
time.sleep(delay)
def reconcile(active, records_match, mail_ready):
complete = records_match is not None and mail_ready is not None
return {
"records_match": records_match,
"mail_ready": mail_ready,
"collection_complete": complete,
"configuration_healthy": (
records_match and mail_ready if active and complete else None
),
"disagreement_alert": (
records_match != mail_ready if active and complete else False
),
}
def main():
domain = os.environ["SENDING_DOMAIN"]
print(json.dumps({"mail_observation": read_mail_status(domain)}))
fixtures = [
("receipts.shop.example", True, True, True),
("orders.shop.example", True, False, True),
("retired.shop.example", False, None, None),
("login.shop.example", True, None, True),
]
for domain, active, records_match, mail_ready in fixtures:
result = reconcile(active, records_match, mail_ready)
print(json.dumps({"domain": domain, **result}, sort_keys=True))
if __name__ == "__main__":
main()
Schedule collection once daily and send the two configuration observations to the metric system alongside collection completeness. The printed dictionaries are diagnostic output, not a metric API request body. Reporting them requires an adapter for the selected metric service. The example implements the mail-status read and the decision logic; it does not collect DNS records or register a scheduled job.
For an active domain with an incomplete collection, raise a collection problem through the monitoring workflow rather than manufacturing a disagreement. For a retired domain, suppress the configuration-disagreement alert. That doesn't justify ignoring unexpected collection gaps across the active inventory.
Retirement is deliberate. Silence is ambiguous.
Compare the authority boundary before consolidating services
Cloudflare DNS, Amazon Route 53, and Amazon SES are real alternatives worth evaluating, but they occupy different parts of this problem. Cloudflare DNS and Route 53 are DNS-management choices; SES supplies the mail-service side. A DNS provider alone cannot supply both observations. Equally, a mail-service status alone cannot establish that the customer's published records still match the intended configuration.
| Option | Role in this design | Boundary to evaluate |
|---|---|---|
| Cloudflare DNS | DNS-side record administration and inspection | Fits an inventory whose relevant zones are managed there; still needs a mail-service observation. |
| Amazon Route 53 | DNS-side record administration and inspection | Fits zones managed there; the sending-domain status remains a separate input. |
| Amazon SES | Mail-side sending-domain identity information | Fits a sending workflow using that service; published records still need their own observation. |
A customer-owned zone should usually remain at its existing DNS provider unless there is a separate reason to move authority. Moving a customer's zone solely to simplify your monitor creates a larger administrative commitment than the check requires. Conversely, a platform already administering the relevant zones can keep collection close to that responsibility. Evaluate the existing mail provider independently.
Infrai fits a backend that needs one key and one bill for DNS, email, scheduling, and metrics, plus SDK-free integration through a single REST API: plain HTTP requests, no SDK to install, and a consistent interface across services. That means fewer service credentials to administer and fewer invoices to reconcile; this Python collector can also reuse standard-library request handling across those backend tasks instead of maintaining separate SDK integrations. Coverage spans 295 routes across 20 modules. Its public, self-describing API discovery requires no key and exposes request and response schemas plus runnable examples. For this collector, that lets the engineer inspect the actual observation shapes before implementing the normalization adapter, rather than guessing which field means the sending domain is ready. These conveniences do not decide who should own a customer's zone or remove the need to reconcile the two observations.
This is a workflow choice. The strongest option respects the customer's authority boundary and gives the operator both sides of the check.
Stop retaining routine payloads, and accept the forensic cost
For this design, keep compact daily configuration metrics and preserve raw observations around disagreements under an explicit retention policy. A proposed starting policy is 30 days for paired metrics and 7 days for incident snapshots; choose longer periods only when an investigation or a defined retention obligation requires them. These are application choices, not claims about any provider's retention behavior. Store the observation time and ownership boundary with incident evidence, so an operator can distinguish an old customer-controlled change from a current platform responsibility.
Stop retaining every healthy response indefinitely. Also stop treating retired domains as an active monitoring obligation once retirement has been recorded.
The cost arrives during reconstruction. After raw healthy snapshots expire, the metrics may show when a disagreement began without preserving the exact prior record values. After incident snapshots expire, the team must rely on whatever change history the responsible DNS owner retained. A daily schedule can also leave a change unseen until the next sweep. Accept those limits explicitly: the design buys a bounded configuration audit trail, and gives up indefinite record-by-record forensics and immediate detection.
Further reading
References:
- DMARC authentication policy and reporting: https://datatracker.ietf.org/doc/html/rfc7489
- Cloudflare DNS documentation: https://developers.cloudflare.com/dns/
- Amazon Route 53 developer guide: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html
- Amazon SES verified identities: https://docs.aws.amazon.com/ses/latest/dg/verify-addresses-and-domains.html
Top comments (0)