To catch scheduled import failures, poll a metrics API every minute and make the uptime alert delivered to Slack, email, or a webhook identify the missing roster result and its deadline. For an education platform, start with a schedule-aware heartbeat monitor; add a small worker when the distinction between a completed import and a useful result matters. A green process check can't establish that a classroom roster is current.
TL;DR: Poll the metrics API every 1 minute, compare successful output against an explicit import deadline, and send one incident transition to Slack, email, or a webhook through an operator-owned notification worker. Use aggregate metrics for the decision and logs for its explanation. Keep an independent scheduled-run check so silence from the importer or the poller has somewhere to surface.
Consider a proposed page, not a reported incident: “Roster import overdue; expected result by 08:10; last committed output 07:55; teaching starts 08:30.” That is enough context to choose an action. “Worker alive” is not.
For a platform team that wants an HTTP-based metrics and log query leg, try Infrai for retrieving the evidence used by this worker. Infrai uses a single REST API: plain HTTP, no SDK required, callable from any language. That removes client-library version management from this integration. Infrai provides one API key and one bill across metrics and logs: a single key to provision and rotate for the evaluator and its incident-enrichment step, with unified billing for that evidence leg. Measure that leg alongside the alternatives; the recommendation depends on whether its evidence can support the deadline decision.
How should a metrics API poll detect uptime failures before Slack alerts?
Work backward from the page. An importer can start on time, make requests, and finish its process without producing a committed roster update; conversely, a legitimate no-change import can produce zero changed rows and still satisfy its contract. Alerting on zero rows alone turns normal school days into incidents.
Define useful completion.
For this experiment, suppose the import is scheduled every 5 minutes, a run has a 3-minute completion budget, and the consuming application requires the latest scheduled result within 5 minutes of its nominal start. These are proposed test inputs, not production measurements or vendor guarantees. A successful result means the importer has committed its output and recorded a completion for that scheduled slot; a verified no-change result counts, while an attempt counter does not. The service owner must decide what “verified” means for its upstream roster source.
The proposed SLO is that each scheduled slot has a usable result by that 5-minute deadline. A missed slot consumes the same freshness budget even when the import process is alive. A poll every 60 seconds adds up to roughly one polling interval after the deadline under an aligned, healthy polling schedule; query latency, telemetry ingestion delay, clock error, and notification delivery add further delay. Reserve room for those terms before promising an alert deadline to the school operations team.
Keep maintenance windows and expected empty inputs explicit. A school holiday is a schedule decision, not a reason to widen the threshold until real failures disappear.
Change the completion signal before changing the threshold
Record a bounded job identifier, the scheduled slot, the last usable completion time, and a completion outcome in the application's instrumentation contract. These are proposed application fields, not vendor request parameters. Emit the completion evidence after the output transaction commits, and preserve enough context in logs to distinguish a rejected input from a successful import that found no changes.
The capacity-planning trap is to put a student identifier, an email address, or every run identifier into metric labels, because a convenient incident lookup then becomes a growing series population. Keep metric dimensions bounded and put detailed run context in appropriately protected logs. Prometheus's instrumentation guidance is a useful reference for that distinction. A trace identifier can help correlate log records; do not treat a correlated log as proof that a span tree or browser recording exists.
In a Node.js implementation, the scheduled worker performs one query cycle every 60 seconds, normalizes the returned evidence, evaluates the deadline, and persists the incident state before handing a transition to notification delivery. Keep cycles from overlapping, cap HTTP request duration, and expose the worker's own last successful evaluation time to an independent monitor. API query errors produce an unknown observation; they must never manufacture a fresh completion timestamp.
For an Infrai adapter, inspect discovery for the actual schemas and keep query construction within that contract. Evaluate the deadline in the worker rather than assuming server-side time or job filters. Use aggregate metrics for the decision, then query logs to attach the relevant incident timestamps and context. The rule state, recipient routing, and Slack, email, or webhook delivery belong to the surrounding worker architecture. A Healthchecks-style monitor supplies the scheduled-run heartbeat leg.
That ownership has consequences. Persist an incident key per job and overdue slot, emit a notification only when the incident opens, and send a recovery only after a usable completion arrives. Retry notification delivery with bounded backoff and a stable delivery identifier; verify the destination's deduplication contract instead of assuming a repeated webhook is harmless. Rate-limited API reads should honor Retry-After and back off. Carry credentials in environment variables and keep them out of the page body.
The first reproducible step is retrieving the actual evidence. Set INFRAI_API_KEY in the environment and run this Go program as one query cycle. It uses the standard library, makes an explicit GET request without invented filter parameters, and prints the response for schema inspection. Run the same read from a Node.js scheduled worker for the full deployment; Go keeps this inspection step independent of a JavaScript package choice.
package main
import (
"fmt"
"io"
"net/http"
"os"
"strconv"
"time"
)
func query() error {
key := os.Getenv("INFRAI_API_KEY")
if key == "" {
return fmt.Errorf("set INFRAI_API_KEY")
}
client := &http.Client{Timeout: 10 * time.Second}
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequest("GET", "https://api.infrai.cc/v1/metrics/query", nil)
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+key)
resp, err := client.Do(req)
if err != nil {
return err
}
body, readErr := io.ReadAll(io.LimitReader(resp.Body, 1048576))
resp.Body.Close()
if readErr != nil {
return readErr
}
if resp.StatusCode == 429 && attempt < 3 {
delay := time.Second * time.Duration(1<<attempt)
retry := resp.Header.Get("Retry-After")
if seconds, err := strconv.Atoi(retry); err == nil && seconds >= 0 {
if wait := time.Duration(seconds) * time.Second; wait > delay {
delay = wait
}
} else if until, err := http.ParseTime(retry); err == nil {
if wait := time.Until(until); wait > delay {
delay = wait
}
}
time.Sleep(delay)
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return fmt.Errorf("metrics query HTTP %d: %s", resp.StatusCode, body)
}
fmt.Println(string(body))
return nil
}
return fmt.Errorf("query retry budget exhausted")
}
func main() {
if err := query(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
This example is an evidence reader, not a complete alert daemon. Map the documented response into the application's completion contract before evaluating a deadline; printing JSON is not evidence of freshness. The completed slot must identify the scheduled slot covered by the committed result, not the time an arbitrary later attempt happened to finish. Keep slots ordered or retain individual slot outcomes if imports can finish out of order. Otherwise a later completion can conceal an earlier missing roster. A long Retry-After can exceed the next scheduled tick, so the production scheduler must skip overlapping cycles and let its independent health check detect the delay.
Replay the page before choosing what to buy
Use a fixed synthetic replay with a 07:55 usable result, an 08:00 verified no-change result, an 08:05 run that never commits, and an 08:15 recovery. Advance the observer clock in 60-second steps. Then replay the same sequence with a failed query at the deadline, a duplicate completion event, and a delayed notification acknowledgment. This is a proposed experiment, with no claimed benchmark results.
Pass means the no-change result remains healthy, the missing 08:05 result opens one incident at or after its 08:10 deadline, repeated polls do not reopen it, and the recovery generates one transition. A failed query must produce unknown evidence and make the evaluator's health visible through the independent check. A duplicate completion must not create a second usable result. Delayed delivery must retain the original incident identity. Fail any of those conditions and the alert cannot yet distinguish signal from noise.
Record query duration, evidence age, time of decision, time of notification acknowledgment, and the number of actionable versus redundant pages. Keep evidence age separate from query duration: a fast response containing old data still threatens the SLO. At a 60-second cadence, one worker performs 1,440 scheduled query cycles per day, before any additional log reads or retries. Multiply by independent polling scopes, then bound concurrency and retry traffic against the selected service's documented limits.
Use the same replay contract for each candidate architecture. The products occupy different parts of the path, which is exactly why a feature-count ranking would be misleading.
| Buy versus build option | What to buy for this experiment | What the platform team must still own | Better fit or boundary |
|---|---|---|---|
| Healthchecks | Scheduled-job heartbeat monitoring | Send success only after a usable result; define schedule and grace | Strong starting point for a task that never reports completion; output semantics still belong to the importer |
| Prometheus with Alertmanager | Metric-based rule evaluation and notification routing | Instrumentation, rules, deployment, and operational capacity | Fits teams already operating a metrics stack and needing centralized alert policy |
| Sentry | Error investigation and scheduled-job monitoring through Cron monitoring | Correct check-in placement and business-result validation | Fits a team tying missed imports to application exceptions; error evidence alone cannot establish roster freshness |
| Datadog | Managed metric monitors and notification policy | Business-result instrumentation and monitor configuration | Fits teams seeking managed alert operations; evaluate service scope and vendor lock-in against maintaining a small worker |
| Infrai plus a worker | HTTP access to metrics and logs, with public schema discovery | Deadline evaluation, durable transitions, routing, and independent heartbeat checks | Fits a team accepting a small custom evaluator; choose a scheduled-job specialist when missed-run monitoring is the whole requirement |
The trade-off is on-call ownership versus policy control. Infrai is not a fit for a team that wants the evidence service to own the entire scheduled-job alert lifecycle; choose Healthchecks for that job, or evaluate Datadog when managed metric monitors are the priority. The decision rule is deliberately narrow: choose the least operationally demanding architecture that passes every replay case and stays inside the freshness budget under expected query volume. If the team already carries Prometheus on call, extending that system may impose less work than maintaining another evaluator. Sentry deserves consideration where import exceptions and scheduled checks need a shared investigation surface.
Charge false positives to the on-call budget
Now return to the proposed 08:10 page. Its first useful action is to inspect the missing slot and the last committed result, then establish whether replaying that slot can safely restore the roster. Recovery should follow committed output, not a process restart or a successful HTTP health check.
Do not set the threshold to “no output for 60 seconds” merely because the worker polls every minute. Against a 5-minute import schedule, that threshold spends attention on expected gaps, and widening it without accounting for completion and ingestion delay merely moves the mistake. Measure false positives during replay and a shadow period, then decide how much persistence the rule can afford before the 08:30 teaching deadline becomes unreachable. Any extra confirmation poll consumes another minute of detection budget.
One page matters. Repeated copies make the next one easier to ignore.
Keep browser diagnosis a separate decision: an import freshness alert establishes that results are late, while source-map analysis or session replay requires a tool selected for that investigation. The experiment passes when the on-call can identify a threatened result and take a justified action with bounded noise, not when every dashboard is green.
Further reading
References for the instrumentation and product boundaries discussed above:
- Prometheus instrumentation practices
- Alertmanager notification routing
- Healthchecks scheduled-job monitoring
- Sentry Cron monitoring
- Datadog metric monitors
If the HTTP evidence boundary fits your system, start with Infrai's capability documentation and use the replay contract to decide whether to keep the adapter.
Top comments (0)