Files
tech-log-backend/docs/runbooks/rate-limit-exceeded.md

3.0 KiB

title, category, error_codes, severity, owner, last_updated, status
title category error_codes severity owner last_updated status
Runbook — Rate limit 초과 spike RATE_LIMIT
RATE_LIMIT_EXCEEDED
IDEMPOTENT_IN_FLIGHT
P3 oncall 2026-05-22 stub

Runbook: Rate limit 초과 spike

1. Trigger

이 runbook은 다음 alert에서 발동됩니다.

  • alert name: rate_limit_429_high
  • alert payload 필수 field: operation, error.code, error.category, rate_limit_key_type(ip|principal|tenant), runbook_link
  • 임계:
    • P3: 429 rate > 1% 10분 지속 (일상적 abuse 차단 효과 정상)
    • P2 격상: 정상 client(known principal/tenant)에서 spike 또는 spike와 함께 5xx 동반

2. First Response (5분 이내)

Step 1 — 확인

  1. rate-limit key 분포 확인: IP/principal/tenant 중 어디서 spike가 발생했는지
    • log query: error.code=RATE_LIMIT_EXCEEDED | stats count by rate_limit_key_type, rate_limit_key
  2. top-N offending key 추출 (상위 10건)
  3. 정상 client 식별 — 알려진 partner/internal service면 P2 격상

Step 2 — 임시 격리

  • abuse traffic 패턴이면 WAF/gateway에서 IP block (geo, ASN 단위)
  • IDEMPOTENT_IN_FLIGHT 다발이면 client의 retry-storm 의심 → client에 retry-after 협조 요청

3. Diagnosis

  • log query: {service="gateway"} | error.code="RATE_LIMIT_EXCEEDED" | stats count by rate_limit_key
  • metric panel: gateway_rate_limit_dropped_total, gateway_rate_limit_bucket_utilization
  • trace: 429 응답의 Retry-After 헤더 값, rate_limit_remaining header 확인
  • 가능한 원인:
    • abuse / bot traffic → IP/ASN block
    • 정상 client의 traffic 증가 (캠페인, 신규 feature) → limit 일시 상향
    • retry-storm (client backoff 미적용) → client에 idempotency-key + exponential backoff 권고
    • limit 설정 오류 (잘못된 정량 threshold) → config rollback

4. Mitigation

  • 단기: abuse면 IP/ASN block, 정상 client면 해당 key의 limit 일시 상향(예: 2x, 1시간 TTL)
  • IDEMPOTENT_IN_FLIGHT 다발: idempotency-key 정책 점검, client 협조 요청
  • 장기: limit 정책을 tenant tier별 차등으로 재설계, abuse pattern detection 자동화

5. Escalation

  • 다음 on-call로 page: 30분 내 정상 client 회복 안 되면 product team 통보
  • 정상 client에 SLO 위반 가능성 있으면 CSM/계정담당 통보

6. Recovery / Verification

  • 회복 확인 metric: 429 rate < 0.5% 10분 지속, 정상 client의 success rate 정상화
  • post-incident:
    • 일시 상향한 limit 원복 (TTL 만료 확인)
    • abuse pattern을 detection rule에 영구 등록
    • retry-storm이면 client SDK 가이드 보완
  • error-codes.yaml rows: RATE_LIMIT_EXCEEDED, IDEMPOTENT_IN_FLIGHT
  • metrics.yaml: gateway_rate_limit_dropped_total, gateway_rate_limit_bucket_utilization
  • 관련 branch: feature-rate-limit-idempotency-contract

Stub 상태 안내: 이 runbook은 skeleton 단계의 stub. 도메인 도입 시 실제 gateway 제품(NGINX/Envoy/Kong 등)·tenant tier 정책·WAF 연동 절차로 보강 필요.