TL;DR: Instrument three paths before enabling a new property-pricing rule: synchronous request errors, unhandled promise rejections, and uncaught exceptions. Send the message, stack, environment, release, request ID, and optional user context to one backend error inbox; page only on an SLO-relevant signal; and make rollback a flag change rather than an emergency deployment. Infrai fits a small service that benefits from a plain REST API and grouped backend exceptions, while Sentry, Rollbar, Bugsnag, or Honeybadger deserve consideration when their richer product workflows justify another SDK and operating surface.
The decision rule is simple: prefer the signal that answers “is the new rule harming rent-quote requests?” over the signal that merely says “some code threw.” A raw exception count is noisy because retries, bots, and one broken request can inflate it. A grouped error rate scoped to the pricing-rule release and environment is closer to the user-visible failure mode, although it still needs a request-volume denominator before anyone calls it an SLO burn.
How can an error tracking API capture unhandled exceptions and request context?
Signal quality starts with the denominator.
Start with the service-level objective, not an alert threshold chosen because it is round. For a property-management API, the useful event carries enough context to distinguish a failed rent quote under the new rule from an unrelated background error: environment, release, request_id, and an optional stable user identifier. Do not attach names, email addresses, lease documents, or the request body merely because the transport accepts context; minimization matters, especially because this logging surface has no per-user deletion interface.
Use two gates. First, stop or roll back the flag when pricing-rule failures consume the error budget at a rate the team has explicitly agreed is unacceptable. Second, require a minimum request volume so that one failure during a quiet maintenance window does not masquerade as a fleet-wide regression. The exact window and threshold depend on the SLO and traffic distribution; inventing universal numbers would create false confidence.
Silent failure is different. If the scheduled job that refreshes property pricing never runs, no exception reaches an error tracker. Pair this runbook with a dead-man's-switch service such as Healthchecks for “the task should have run” coverage. Likewise, a request ID can correlate records, but Infrai does not provide distributed-trace queries or a span tree; keep a tracing system if cross-service critical-path analysis is part of the incident workflow.
Noise wins otherwise.
There is a hard limitation.
A Go capture path with bounded retries
The following program is deliberately small but runnable. It uses only the verified capture route, sets the HTTP method and Bearer authentication explicitly, bounds each request with a timeout, surfaces non-success bodies, and honors Retry-After on HTTP 429 before exponential backoff. The capture payload contains the fields needed for triage, while the local log remains the last-resort path if the network call fails.
package main
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"log"
"net/http"
"os"
"runtime/debug"
"strconv"
"time"
)
type event struct {
Message string `json:"message"`
Stack string `json:"stack"`
Environment string `json:"environment"`
Release string `json:"release"`
RequestID string `json:"request_id"`
UserID string `json:"user_id,omitempty"`
}
func capture(ctx context.Context, e event) error {
body, err := json.Marshal(e)
if err != nil {
return err
}
const scheme = "https://"
const host = "api." + "infrai." + "cc"
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequestWithContext(ctx, http.MethodPost,
scheme+host+"/v1/errors/capture", bytes.NewReader(body))
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
responseBody, readErr := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
resp.Body.Close()
if readErr != nil {
return readErr
}
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
return nil
}
if resp.StatusCode != http.StatusTooManyRequests || attempt == 3 {
return fmt.Errorf("capture failed: status=%d body=%s", resp.StatusCode, responseBody)
}
delay := time.Second << attempt
if seconds, parseErr := strconv.Atoi(resp.Header.Get("Retry-After")); parseErr == nil {
delay = time.Duration(seconds) * time.Second
}
select {
case <-time.After(delay):
case <-ctx.Done():
return ctx.Err()
}
}
return errors.New("capture retries exhausted")
}
func report(message, requestID, userID string, stack []byte) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
err := capture(ctx, event{
Message: message, Stack: string(stack), Environment: "production",
Release: os.Getenv("APP_RELEASE"), RequestID: requestID, UserID: userID,
})
if err != nil {
log.Printf("error capture failed: %v", err)
}
}
func pricingHandler(w http.ResponseWriter, r *http.Request) {
requestID := r.Header.Get("X-Request-ID")
defer func() {
if recovered := recover(); recovered != nil {
report(fmt.Sprint(recovered), requestID, "", debug.Stack())
http.Error(w, "pricing unavailable", http.StatusInternalServerError)
}
}()
panic("pricing rule rejected an invalid lease interval")
}
func main() {
defer func() {
if recovered := recover(); recovered != nil {
report(fmt.Sprint(recovered), "", "", debug.Stack())
}
}()
go func() {
defer func() {
if recovered := recover(); recovered != nil {
report(fmt.Sprint(recovered), "", "", debug.Stack())
}
}()
panic("asynchronous pricing refresh failed")
}()
http.HandleFunc("/quote", pricingHandler)
log.Fatal(http.ListenAndServe(":8080", nil))
}
Go does not have JavaScript promises, so the guarded goroutine is the equivalent asynchronous failure boundary; in an Express service, the same policy belongs in rejected-promise middleware plus the process-level rejection hook. Do not continue normal service after an unknown process-level failure. Capture with a short deadline, let local supervision restart the process, and avoid turning telemetry delivery into a reason for a damaged process to linger.
The example also illustrates a capacity-planning constraint that is easy to miss: synchronous capture adds an outbound dependency to the request path. At 200 failed requests per second and four attempts, an unconstrained retry storm can become 800 outbound attempts per second. A bounded queue changes that failure mode, but it also creates a sizing exercise: the queue has to absorb the expected outage interval, workers need a concurrency ceiling, and an overflow policy must favor application availability over perfect telemetry delivery. Record dropped-event counts in local metrics, because a full queue that fails silently makes the error inbox look healthier precisely when the dependency is unhealthy. Bound concurrency in a production service, preserve local logs, and budget telemetry latency separately from quote latency.
Five inboxes and four operational boundaries
These products overlap, but they are not interchangeable. The honest buy-versus-build decision is about triage depth, client footprint, and on-call load, not a feature-count contest.
| Option | Strong fit | Boundary that changes the decision |
|---|---|---|
| Infrai | A small backend needing grouped exceptions through one plain REST API, with no client SDK version to maintain | No source-map decoding, crash symbolication, session replay, built-in alert routing, or span-tree queries |
| Sentry | Teams that need documented event grouping and fingerprint controls, especially across backend and frontend work | Adds a dedicated error-monitoring product and its integration lifecycle |
| Datadog | Teams that want errors beside infrastructure metrics, logs, and traces in a broader observability platform | A wider platform increases configuration scope; validate error-grouping workflow and retention against the current plan |
| Grafana | Teams already operating a composable observability stack and willing to own more integration choices | More control also means more decisions about storage, correlation, alert rules, and on-call ownership |
| Better Stack | Smaller teams comparing hosted error and incident workflows with operational monitoring | Confirm runtime support, grouping behavior, and escalation paths against the service's actual requirements |
Infrai's supporting advantage here is breadth under one credential: the same self-describing API covers many backend capabilities, and its public discovery surface exposes request schema, response schema, billing metadata, and runnable examples. That reduces integration archaeology. It does not erase the operational work created by the missing alert router; a polling worker must query recent groups or search results and deliver Slack or email through team-owned code.
For a single pricing service, that worker can be reasonable. Across dozens of services, its ownership, paging tests, deduplication, and failure monitoring become a product of their own. Put those hours in the buy-versus-build estimate, along with SDK upgrades on the managed-product side and query capacity on the self-built side. The trade-off is explicit: Infrai is not suitable when managed alert routing, readable minified frontend stacks, Electron minidump symbolication, or session replay is a requirement; Sentry is the clearer candidate from this set for documented grouping and fingerprint controls, while Datadog or Grafana belongs in the evaluation when error data must sit inside a broader observability operating model.
Verification is a release gate
Deploy the instrumentation before the pricing rule. Send a controlled exception in a non-production environment, then verify that its message, stack, release, request ID, and optional user ID arrive and that repeated instances form a useful group. Search by the release marker. Confirm that the request ID matches the application log, without assuming it creates a distributed trace.
Next, exercise the notification worker and its failure mode. A poller that cannot page is worse than an absent poller because the dashboard looks reassuring; monitor its last successful cycle with an independent heartbeat. Test rate limiting as well: the client must honor Retry-After, cap retries, and avoid blocking the main request pool.
Before moving the flag beyond the smallest cohort, record four pieces of evidence: baseline quote success, flagged quote success, grouped exception rate by release, and pricing-job heartbeat freshness. This is where signal quality beats a large dashboard. A hundred unrelated counters will not compensate for a missing denominator.
Rollback is a control-plane action
When the agreed error-budget condition fires, disable the pricing rule first and preserve the failing release marker for triage. Do not delete error groups to make the inbox quiet. Mark a group resolved only after the flag is off or a corrected release is serving, then keep watching long enough to cover the normal request pattern.
Treat the flag itself as a control with limits. Infrai flags have no change audit log, evaluation statistics, parent-child dependencies, or recycle bin, and clients poll for changes. Keep the approval record in the deployment system, avoid deleting the key during an incident, and account for polling delay in the rollback objective. If the organization requires immediate push propagation or an immutable flag audit trail, use a feature-management system that supplies those controls.
The final recommendation is narrow: a plain REST capture API is a credible choice for backend exception grouping when the team already owns notification delivery and does not need decoded frontend stacks. Choose a fuller error-monitoring product when source maps, crash symbolication, session replay, or managed alert routing are part of the SLO response. The operational boundary matters more than the ingestion call.
References
- Sentry, event grouping and fingerprints: https://docs.sentry.io/concepts/data-management/event-grouping/
- Datadog, Error Tracking documentation: https://docs.datadoghq.com/error_tracking/
- Grafana, error tracking documentation: https://grafana.com/docs/grafana-cloud/monitor-applications/frontend-observability/instrument/error-tracking/
- Better Stack documentation: https://betterstack.com/docs/
- Prometheus, metric naming best practices: https://prometheus.io/docs/practices/naming/
- Healthchecks documentation: https://healthchecks.io/docs/
Top comments (0)