Skip to content
InfraChallenge Docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Incident response

Severity levels, alert routing and paging, the runbook for SuggestionFailureBudgetBurn, and the review after an incident.

Severity levels

Level Meaning Example Response
SEV1 Most users cannot load, save or get suggestions, or document data may be exposed Every task unhealthy; a leaked key Page now, around the clock. One incident lead. Status updates every 30 minutes.
SEV2 A core path is degraded and the error budget burns fast SuggestionFailureBudgetBurn, 5xx ratio above 5% Page now. Mitigate first (roll back, switch the model), diagnose after.
SEV3 Degraded but not urgent, or one customer affected p95 response time alarm, an Aurora alarm A ticket for working hours. No page.

Alert routing

  • Built. Every alarm goes to one SNS topic (infrastructure/modules/observability). The topic has one email subscription, and alarm_email is null in every environment today, so nobody is notified yet.
  • Described, not built. A PagerDuty integration subscribed to the topic. The on-call is the engineering team, on a weekly rotation. SEV1 and SEV2 alarms page. SEV3 alarms open a ticket, which needs a second topic or PagerDuty event rules to tell them apart; today all alarms share one topic.
  • Locally there is no Alertmanager. The alert shows on http://localhost:9090/alerts and nothing is sent.

Runbook: SuggestionFailureBudgetBurn

What it means

More than 7.2% of AI suggestion requests ended as ai_error or invalid_response, in both the last hour and the last 5 minutes. At this rate the 30-day error budget of the 99.5% objective is gone in about 2 days. Users type and get no suggestions, with no error shown: the handler sends nothing on failure. The page loads, so nothing else looks wrong.

In AWS the same condition is the alarm <name>-suggestion-failure-ratio (5-minute window only). During a release it also rolls the release back.

First checks (5 minutes)
  1. Did a release just go out? Check the latest GitHub Deployment for the environment and the deploy.yml run. If the alarm fired during a rollout, ECS has probably already rolled it back; verify-deployment.sh turns the job red.
  2. Dashboard Patent server: suggestions:
    • Panel Suggestion requests by outcome: is it ai_error or invalid_response? Did ok drop to zero, or only partly?
    • Panel Suggestion failure ratio vs objective: when did the 5m line cross the 7.2% threshold line?
    • Panel Suggestion duration p50 and p95: are failures fast (rejected) or slow (timeouts)?
    • Panel Suggestions in flight: a rising line with few completions means calls hang.
  3. Which error. In CloudWatch Logs Insights on /ecs/<name>-server:
    fields @timestamp, outcome, `error.type`, trace_id
    | filter event = "suggestion.failed"
    | stats count() by `error.type`, outcome
  4. One failing trace. Take a trace_id from that query. In X-Ray, filter with annotation.suggestions_outcome = "ai_error". Locally in Jaeger, search service patent-server, operation suggestions.review, tags suggestions.outcome=ai_error. The child POST span shows OpenAI’s HTTP status.
Likely causes
error.type Outcome Likely cause Action
NotFoundError ai_error OPENAI_MODEL names a model that does not exist or was retired Revert the openai_model change in Terraform, then release
AuthenticationError, PermissionDeniedError ai_error The key in Secrets Manager was rotated, revoked or emptied Put a valid key; replace tasks (secrets are read at task start)
RateLimitError ai_error OpenAI quota or tokens per minute Raise the quota; check for a traffic spike in requests by outcome
APITimeoutError, APIConnectionError, InternalServerError ai_error OpenAI outage, or egress (NAT) failure Check the OpenAI status page and NAT gateway metrics. A rollback does not help.
ValidationError invalid_response The model returns JSON that does not fit Suggestions: a prompt or model change Roll back the release that changed it
Roll back
  • Caused by a release: run rollback.yml for the environment with a reason. It re-releases the last successful SHA and freezes deploys. See Rollback.
  • Caused by configuration (openai_model, the key): revert in Terraform. A task definition change reaches the tasks only with the next release, so run deploy.yml after the apply.
  • Caused by OpenAI: nothing to roll back. Post on the status page, and keep the alert open until the 5-minute window recovers.
  • An alarm already in ALARM when a deployment starts is not watched by ECS for that deployment, so a fix-forward release during the incident has no alarm rollback.
Resolution

The alert clears when the 5-minute ratio drops below 7.2%. Measured locally, that took about 5 minutes after the fix, as the failures aged out of the window.

After an incident

Every SEV1 and SEV2 gets a written, blameless review within five working days. The template has five parts:

  1. Timeline. First bad event, detection, page, mitigation, resolution, from the alarm history and the release records.
  2. Impact. Failed requests and budget spent, from suggestions.requests by outcome.
  3. Causes and the contributing gaps. For example, a change with no staging soak, or a missing alarm.
  4. Actions. Each one has an owner and a date, and lands as a pull request or an issue.
  5. Alert check. Did the alert fire early enough, and was it actionable? Tune the threshold or the runbook in the same review.

Was this page helpful?