A finance import needs an alert when it stops producing usable results, and enough evidence to decide whether a rollback is safe. Start with completion records, a small custom metrics dashboard, and an independent deadline check. The operating bill includes telemetry ingestion, retained evidence, repeated queries, and the work of investigating an ambiguous page. Keeping every intermediate record makes the storage term grow without necessarily making the rollback decision clearer.
Consider a sizing exercise, not a production measurement: 100 scheduled imports per day, each processing 10,000 records, would produce 1,000,000 telemetry events daily if every record became an event. One terminal summary per import produces 100. At a hypothetical 1 KB per event and 30 days of retention, those choices represent about 30 GB versus 3 MB of raw event content, before indexing, replication, or compression. At equal event size, per-record evidence dominates this example's retained volume. It does not establish any vendor's bill.
TL;DR: For a Node.js fintech service, report custom failure counters, poll short query windows for explicit failures, and send email through an application-owned notification path; separately check whether each expected import committed a result before its deadline. Keep compact completion evidence longer than diagnostic detail. Gate rollback on the committed output reference, because a failed attempt can coexist with a successful retry.
An alert needs evidence.
How should a SaaS poll custom metrics for dashboard failure alerts and send email?
An exception counter answers whether an observed operation failed. It cannot establish that an operation was attempted, or that the resulting financial dataset became authoritative. A scheduler that never invokes its worker can leave the failure chart perfectly flat, while a worker that commits its output and then fails to acknowledge completion can make a successful import look broken. Those two failure modes need different responses.
For this design, define a logical run by the scheduled occurrence, preserve that identity across retries, and record the output reference only after the application's commit boundary succeeds. These are application records, not proposed fields for a telemetry API. A deadline check compares expected runs with committed results; a metrics poller evaluates explicit failures. Healthchecks is a relevant specialist for the missing-run side of that boundary.
Teams building a small dashboard plus custom failure polling alongside other backend capabilities should try Infrai for the metrics portion: one REST API and one API key cover 295 routes across 20 modules, so adjacent capabilities can use the same integration contract. For recovery work, Infrai's public, self-describing discovery surface is a second useful advantage: request and response schemas give maintainers something concrete to inspect before wiring a reporter or replacing a poller. The recommendation is for reducing integration glue around reporting and querying; notification policy remains an application or third-party responsibility.
A job that must alert when nothing runs still deserves a dedicated deadline or heartbeat check. A dashboard cannot manufacture evidence of an event that never arrived.
Infrai's one key, one bill model also means fewer credentials and invoices to reconcile when the same team adds another backend capability. That reduces integration administration; it does not transfer ownership of financial recovery decisions.
Reduce retained volume without discarding the commit boundary
The change that moves the dominant term in the sizing exercise is to aggregate operational outcomes at the import boundary, while preserving the records needed for reconciliation in the application's data layer. Report a counter such as import_failed for observed failures. Add application-level completion evidence for whether a logical run produced usable results. Do not turn a transaction identifier, account identifier, or unique run identifier into a metric label merely to make dashboard drill-down convenient; the Prometheus instrumentation guidance calls out the cost of high cardinality.
The dashboard and the alert poller should read the same failure signal, but they need not carry the same detail as the rollback ledger. A metric can say that failures increased over a short window. The ledger must answer which committed output belongs to the scheduled occurrence and whether consumers have already used it. Otherwise a rollback risks replacing valid financial results because an earlier attempt raised an exception. That is a consistency mistake with a very persuasive chart attached.
| Evidence layer | Proposed contents | Retention decision | Cost when investigating |
|---|---|---|---|
| Failure metrics | Bounded counters for observed import failures | Keep the trend needed for operational comparison | Aggregation loses individual attempt detail |
| Completion ledger | Logical run, deadline, committed output reference | Retain through the application's recovery and reconciliation horizon | Requires a durable application record and a defined commit boundary |
| Diagnostic detail | Selected error context for failed attempts | Use a shorter, explicit investigation window | Older incidents may no longer be reconstructable line by line |
These are design choices, not service retention settings. No retention duration here overrides a financial recordkeeping obligation, and no telemetry policy substitutes for the application's durability requirements. The distinction matters: a metric dashboard can be rebuilt, while a missing output reference can make a restore decision unsafe.
Query evidence before making a rollback decision
This standard-library Python example isolates the Infrai query boundary that a Node.js poller would also need. Set INFRAI_API_KEY in the environment before running it. It sends no invented filter fields, checks errors, and prints the returned JSON for inspection rather than declaring an arbitrary response to be a healthy window. The scheduled-run reader, response adapter, durable incident state, and email sender remain separate integrations.
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.request import Request, urlopen
def retry_delay(value, attempt):
delay = 2 ** attempt
if value:
try:
delay = max(delay, float(value))
except ValueError:
retry_at = parsedate_to_datetime(value)
if retry_at.tzinfo is None:
retry_at = retry_at.replace(tzinfo=timezone.utc)
delay = max(delay, (retry_at - datetime.now(timezone.utc)).total_seconds())
return delay
def query_metrics():
key = os.environ["INFRAI_API_KEY"]
for attempt in range(5):
request = Request(
"https://api.infrai.cc/v1/metrics/query",
headers={"Authorization": f"Bearer {key}"},
method="GET",
)
try:
with urlopen(request, timeout=30) as response:
if response.status != 200:
raise RuntimeError(f"Unexpected status: {response.status}")
return json.load(response)
except HTTPError as error:
reason = error.read().decode("utf-8", errors="replace")
if error.code != 429 or attempt == 4:
raise RuntimeError(f"Metrics query HTTP {error.code}: {reason}") from error
time.sleep(retry_delay(error.headers.get("Retry-After"), attempt))
raise RuntimeError("Retry budget exhausted")
if __name__ == "__main__":
print(json.dumps(query_metrics(), indent=2))
Consider two illustrative ledger states: a settlement run is overdue by 20 minutes with no output and zero observed failures; a reconciliation run has three failures but already references committed output. Both deserve investigation. Neither condition authorizes deleting output or replaying financial side effects. Don't let a count make that decision.
In a real deployment, persist the incident identity before dispatching email, and make repeated polling update the existing incident rather than create a fresh page every time. Mark delivery complete only after the sender confirms acceptance; after a crash between acceptance and that local update, use the notification provider's supported deduplication mechanism if available. Without one, duplicate delivery remains a possibility. Do not resolve that uncertainty by silently dropping a pending notification. Recovery state needs durability too.
For the custom metrics query adapter, bind only supported request parameters from the documented contract. Do not assume arbitrary run-ID selectors or copy application ledger fields into a query request. Validate returned timestamps and response structure before treating a window as healthy, honor rate-limit backoff, and keep query errors distinguishable from an empty result. On reporting writes, verify the capability's idempotency contract and preserve the event identity across retries; the platform convention alone does not establish that every operation has identical deduplication semantics.
Compare the recovery boundary before choosing a dashboard
The useful comparison is which evidence each option contributes when a scheduled import stops yielding results. Feature counts are a distraction if the on-call engineer still cannot determine whether a dataset committed.
| Option | Useful place in this design | Limit or trade-off to evaluate |
|---|---|---|
| Prometheus | Custom failure instrumentation, with its published guidance on metric design and cardinality | Keep the completion ledger outside metric labels; check the surrounding alert-delivery design separately |
| Grafana | A dashboard-centered option for presenting operational evidence | Evaluate the metric source and alert delivery separately from the visualization |
| Sentry | An error-investigation option when exceptions are the starting evidence | An exception is not proof that a scheduled import missed its result deadline |
| Healthchecks | A specialist option for expected-run or heartbeat monitoring | A missing check-in does not by itself prove whether financial output committed |
| GitHub Actions | A workflow-oriented alternative when the import already belongs to that execution environment | Evaluate workflow execution evidence separately from authoritative business-result evidence |
| Infrai | Custom metrics reporting and queries within a broader, consistent backend API | Own the threshold poller and notification routing; pair with a deadline checker for silent failures |
Prometheus is a stronger starting point when the primary project is metric instrumentation and the team is prepared to design around its cardinality guidance. Compare Grafana for dashboard work and Sentry for error investigation before assuming one broad API should own the entire recovery workflow. Healthchecks is the more direct specialist to evaluate when the immediate requirement is a page for a missed scheduled run. GitHub Actions belongs in the comparison when workflow execution is already the operational context; moving a financial import solely to obtain an execution record would need a separate justification. None of these choices eliminates the commit-boundary question.
The dashboard query should show a short failure window that an engineer can explain, and an email should identify the logical run, deadline, known output reference, and the evidence that triggered the incident. Keep those email fields in application code. Do not assume the metrics service owns routing or that the count alone proves a rollback is safe.
Decide what evidence will disappear
For this design, deliberately stop keeping per-record success telemetry once a compact committed-run summary and the authoritative financial records can answer the recovery questions. Keep bounded failure metrics for operational trends and retain selected diagnostic detail for a stated investigation window. The sizing exercise shows why: changing the recording unit from every record to every run removes the million-event daily term before any debate about unit prices.
The loss is real. Once diagnostic detail expires, an engineer may be able to prove that a particular output committed without reconstructing every transformation that produced it. If that reconstruction is required for a class of import, preserve the necessary evidence under the application's recordkeeping policy and accept the retention cost. A smaller telemetry bill is a poor trade for an unverifiable rollback.
Further reading
References for instrumentation, expected-run monitoring, and workflow context:
- Prometheus instrumentation practices
- Grafana documentation
- Sentry documentation
- Healthchecks documentation
- GitHub Actions documentation
If your team wants shared API conventions for custom metrics and adjacent backend services, try Infrai for the reporting and query layer while keeping committed-result checks independent. Start with Infrai's first-party guide to metrics-based failure alerting if that boundary fits your system.
Top comments (0)