The page says checkout is failing. Express error tracking with Pino or Winston needs request ID correlation between logs and exceptions so the on-call can reconstruct the failure. Otherwise, the responder opens an exception group, finds a stack trace, and still cannot tell which request handed work to the background worker. For a developer-tools checkout that provisions a purchased workspace asynchronously, that missing handoff is the evidence that matters: did the request fail, did the worker fail, or did the scheduled follow-up never run? This is a design scenario, not a reported incident.
Short answer: combine Express structured logging through Pino or Winston with exception capture, and put the same request_id on both. Send ordinary operational records to log ingestion; send exceptions that need grouping and triage to error capture. Carry the identifier into background work, then attach the run evidence to the captured exception so the responder can reconstruct checkout from one identifier.
Keep paging separate. A captured exception is evidence; the alert rule decides whether that evidence warrants interrupting somebody. The selection criterion here is incident reconstruction, including the work that happens after the HTTP response, rather than the number of dashboards a backend offers.
How should Express error tracking connect Pino or Winston logs to exceptions?
A useful page identifies the failing workflow and points to evidence that distinguishes a request failure from a worker failure. A stack trace alone cannot establish that a purchased workspace was provisioned, and an HTTP success record cannot establish that its deferred work completed. Define a checkout SLO around the user-visible result before choosing which count triggers the page; otherwise, the dashboard can look healthy while the customer waits for the thing they bought.
Follow the handoff before changing the threshold.
For each accepted request, generate or validate a request identifier at the trusted application boundary. Bind that value to the request-scoped Pino logger or the corresponding Winston logging context, and explicitly include it when capturing an exception. The names of those logger APIs differ; the contract should not. A practical internal record can carry request_id, a workflow name, a stage, and an outcome. These are application-owned fields, not a claim about any ingestion API's accepted payload.
For example, use a synthetic request identifier such as checkout-demo-17 through request acceptance, worker dispatch, and worker completion. Keep a worker run identifier alongside it rather than replacing it. A retry is a new attempt at the same logical work; losing that distinction makes three failed attempts look like three unrelated customer failures. Conversely, grouping solely by request identifier can hide the exception signature that connects failures across customers. Preserve both correlation and grouping. Consider the responder's next question: if two attempts failed and the third completed, did the customer experience a failed checkout or a delayed one? Answering that requires a logical completion record and attempt evidence together. Counting exception events cannot settle it. Keeping this distinction in the application's record contract also prevents a later backend migration from silently changing what the checkout SLO measures.
Don't count attempts as customers.
Do not attach the checkout body to every log line. OWASP's logging guidance is a useful boundary here: credentials and payment details do not become safe just because the destination calls them telemetry. Decide which identifiers are safe to retain, restrict arbitrary incoming identifiers, and prevent sensitive content from entering exception messages before it reaches either channel.
Work backward from the page to the earlier signal
The earlier signal should describe a missing or failed transition. A request-accepted log establishes the start of the workflow. A run record establishes that scheduled work has execution evidence. An exception event establishes that a failure was captured. None of those, by itself, establishes the entire checkout outcome, so the alert evaluator must connect the evidence to a completion criterion rather than page on every record with an error level.
There are two different failure classes. An exception gives you something to group.
A job that never starts gives you silence.
Use a heartbeat or scheduled-job monitor, such as Healthchecks, for that second class, and make the paging path an explicit dependency of the design. Treat distributed trace trees, source-map processing, crash symbolication, and session replay as separate selection requirements when the investigation needs them. Shared identifiers connect records; they do not create those capabilities. Likewise, release flags need their own audit and evaluation evidence if a responder must prove which configuration caused a checkout failure.
Capacity planning starts at the boundary between the two channels. As a hypothetical sizing exercise, 100 requests per second with 4 operational records each means 400 log records per second before worker records and retries. That is arithmetic, not a benchmark. Sending all 400 records into exception capture would make the triage queue a second log store, and a burst of retries could multiply the evidence without adding another affected checkout. Budget logging throughput, exception volume, and alert evaluation separately.
Make the worker-to-exception handoff explicit
Infrai offers a self-describing REST API, no SDK required, and one API key with one bill across capabilities. Public discovery requires no key and supplies request and response schemas plus runnable examples, so a new capability starts with reading its discovery entry rather than learning another SDK. For this workflow, the supporting advantage is that a single key connects run retrieval and exception capture, letting a small relay carry run evidence into the exception channel. The tradeoff is one vendor to trust and one outage surface.
The following Go program demonstrates that exact handoff. It retrieves one known cron run, treats the returned JSON as opaque evidence, and inserts that evidence into a documented exception request template before capture. It deliberately leaves the template to the service's runnable example instead of guessing exception field names. This is the worker evidence portion of an Express integration; Pino or Winston still owns the request's operational logging.
Supply API_BASE_URL as the service's HTTPS API base ending in /v1, INFRAI_API_KEY, CRON_ID, and RUN_ID. Set ERROR_CAPTURE_TEMPLATE to a valid capture-request JSON object copied from the capability's runnable example, retain the originating request identifier in an appropriate documented field, and place the literal token RUN_EVIDENCE inside a documented string field. The program replaces that token with the run response and preserves JSON escaping. Save it as main.go and run it with the Go toolchain; it uses only the standard library.
package main import ( "bytes" "crypto/sha256" "encoding/json" "fmt" "io" "net/http" "net/url" "os" "strconv" "strings" "time" ) func required(name string) string { value := os.Getenv(name) if value == "" { panic("missing " + name) } return value } func exchange(method, endpoint, key string, body []byte) ([]byte, error) { client := &http.Client{ Timeout: 15 * time.Second, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }, } digest := sha256.Sum256(body) for attempt := 0; attempt < 4; attempt++ { req, err := http.NewRequest(method, endpoint, bytes.NewReader(body)) if err != nil { return nil, err } req.Header.Set("Authorization", "Bearer " + key) if method == http.MethodPost { req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", fmt.Sprintf("%x", digest)) } resp, err := client.Do(req) if err != nil { return nil, err } data, readErr := io.ReadAll(resp.Body) resp.Body.Close() if readErr != nil { return nil, readErr } if resp.StatusCode == http.StatusTooManyRequests && 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 d := time.Duration(seconds) * time.Second; d > delay { delay = d } } else if date, err := http.ParseTime(retry); err == nil { if d := time.Until(date); d > delay { delay = d } } time.Sleep(delay) continue } if resp.StatusCode < 200 || resp.StatusCode >= 300 { return nil, fmt.Errorf("HTTP %d: %s", resp.StatusCode, data) } return data, nil } return nil, fmt.Errorf("retry budget exhausted") } func main() { base := strings.TrimRight(required("API_BASE_URL"), "/") parsed, err := url.Parse(base) if err != nil || parsed.Scheme != "https" || parsed.Host == "" || parsed.Path != "/v1" || parsed.RawQuery != "" || parsed.Fragment != "" { panic("API_BASE_URL must be an HTTPS API origin ending in /v1") } key := required("INFRAI_API_KEY") runPath := "/cron/runs/get/" + url.PathEscape(required("CRON_ID")) + "/" + url.PathEscape(required("RUN_ID")) run, err := exchange(http.MethodGet, base + runPath, key, nil) if err != nil { panic(err) } if !json.Valid(run) { panic("run response is not JSON") } var payload map[string]any if err := json.Unmarshal([]byte(required("ERROR_CAPTURE_TEMPLATE")), &payload); err != nil { panic(err) } replaced := false var insert func(any) any insert = func(value any) any { switch v := value.(type) { case string: if strings.Contains(v, "RUN_EVIDENCE") { replaced = true return strings.ReplaceAll(v, "RUN_EVIDENCE", string(run)) } case map[string]any: for k, child := range v { v[k] = insert(child) } case []any: for i, child := range v { v[i] = insert(child) } } return value } insert(payload) if !replaced { panic("template needs RUN_EVIDENCE in a string field") } body, err := json.Marshal(payload) if err != nil { panic(err) } if _, err := exchange(http.MethodPost, base + "/errors/capture", key, body); err != nil { panic(err) } fmt.Println("Captured run evidence") } The same key and base are passed to both requests. The POST uses a body-derived idempotency key, including the run evidence, so rate-limit retries of that request do not create another capture. Backoff is bounded by an attempt count, honors Retry-After, and surfaces non-success response bodies rather than treating every response as accepted evidence. This is a single-run diagnostic relay, not a production scheduler or a promise of exactly-once workflow execution.
Only run it against sanitized demonstration records.
Embedding an entire run response makes the handoff visible, but a production adapter should select approved evidence fields, enforce payload limits from the request schema, and use a stable event identifier that survives process restarts. Do not infer a run's success from the retrieval request succeeding. The example neither interprets undocumented run fields nor automatically decides when to page.
For queued checkout work, carry the same correlation identifier and keep consumer idempotency separate from capture idempotency: recording an exception once does not prevent provisioning a workspace twice. A dead-letter identifier can be part of the application's incident record, but this example demonstrates cron-run retrieval only; it does not assert a dead-letter inspection API.
Buy or build around the evidence you need
The Pino-versus-Winston choice is smaller than the backend decision. Keep either logger's structured output and exception delivery as distinct paths with shared context. A logger migration should not require changing how the team identifies an affected checkout.
| Option | Buy versus build boundary | Fit and investigation tradeoff |
|---|---|---|
| Sentry | Buy exception grouping and use its documented logs and Cron Monitoring integrations where appropriate; build the application correlation contract. | A reasonable starting point when exception triage drives the investigation. Confirm that the checkout worker's run evidence reaches the event rather than assuming monitoring supplies it. |
| Datadog | Buy a broader logs and tracing platform; build consistent request-context propagation and choose ingestion policies. | Fits a team that wants logs and traces in the investigation. Instrumentation coverage and data volume remain platform work. |
| Grafana Loki | Adopt a log aggregation system, managed or self-hosted; build or integrate exception triage and worker monitoring. | Fits teams that want control over their logging stack. Self-hosting adds capacity planning and on-call ownership. |
| A shared-key REST backend | Buy run retrieval and error capture behind one credential; build the correlation relay and external alert evaluator. | Fits a narrow evidence handoff. Validate paging, privacy, and export requirements as distinct acceptance criteria. |
The alternative stack of SQS dead-letter queues plus Sentry Crons introduces 2 service relationships: AWS and Sentry, with separate AWS credentials and Sentry credentials. An organization may already have both accounts, so this is not necessarily two new signups. The glue still needs to map queue messages, worker attempts, cron check-ins, and captured exceptions to the originating checkout identifier; dead-letter handling must preserve that identifier too. A shared key reduces credential plumbing, but it cannot supply application semantics.
For procurement, require a demonstration of bulk export, deletion by user, retention controls, and the exact searches the runbook needs. Keep privacy-sensitive records out of ingestion until those requirements are satisfied. Require documented query syntax rather than inventing filters. None of these tests is answered by having a discovery endpoint, and none should be deferred until an incident or a deletion request arrives.
Close the loop without buying noisy pages
Choose the instrumentation change first: one request identifier across Express logs, exception events, and worker evidence, with a completion signal tied to the checkout SLO. Then exercise a request failure, a worker exception, and a missing run as separate synthetic cases. The responder should be able to tell them apart without guessing from timestamps.
Thresholds deserve the same skepticism as integrations. Paging on one captured exception can interrupt the team for a recovered attempt; waiting for a large raw error count can hide a low-volume checkout failure. Evaluate affected logical checkouts and elapsed completion time against the SLO, allow the workflow's intended retry behavior, and make the alert evaluation cadence part of the detection budget. There is no measured detection-time claim here.
A false positive costs attention.
Enough of them also teach the on-call to delay opening the next page, which defeats the purpose of collecting all this evidence. The useful result is a page that leads directly to a reconstructable checkout, with a threshold justified by customer impact rather than whichever counter was easiest to query.
References
These references cover log handling and the alternative stacks' integration boundaries.
- OWASP Logging Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html
- Sentry JavaScript Express documentation: https://docs.sentry.io/platforms/javascript/guides/express/
- Sentry Cron Monitoring: https://docs.sentry.io/product/crons/
- Datadog log and trace correlation: https://docs.datadoghq.com/tracing/other_telemetry/connect_logs_and_traces/
- Grafana Loki documentation: https://grafana.com/docs/loki/latest/
- Amazon SQS dead-letter queues: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
Further reading
- Pino request logging middleware: https://github.com/pinojs/pino-http
- Winston logging documentation: https://github.com/winstonjs/winston
- Healthchecks documentation: https://healthchecks.io/docs/