视觉画布设计
canvas-design
基于设计原则创作静态视觉作品,用于海报与品牌图形。
write-incident-runbook【文档与办公】Create structured incident runbooks with diagnostic steps, resolution procedures, escalation paths, and communication templates for effective incident response. Use when documenting response procedures for recurring alerts, standardizing incident response across an on-call rotation, reducing MTTR with clear diagnostic steps, creating training materia…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
建立可行之事件處理手冊,引導應變者完成事件診斷與解決。
完整範本文件見 Extended Examples。
依事件類型與複雜度選擇適當之範本。
基本手冊範本結構:
# [Alert/Incident Name] Runbook
## Overview | Severity | Symptoms
## Diagnostic Steps | Resolution Steps
## Escalation | Communication | Prevention | Related
進階 SRE 手冊範本(節錄):
# [Service Name] - [Incident Type] Runbook
## Metadata
- Service, Owner, Severity, On-Call, Last Updated
## Diagnostic Phase
### Quick Health Check (< 5 min): Dashboard, error rate, deployments
### Detailed Investigation (5-20 min): Metrics, logs, traces, failure patterns
# ... (see EXAMPLES.md for complete template)
關鍵範本元件:
預期: 所選範本匹配事件複雜度,各段適合服務類型。
失敗時:
完整診斷查詢與決策樹見 Extended Examples。
以特定查詢建立逐步調查程序。
六步診斷清單:
驗證服務健康:健康端點檢查與運行指標
curl -I https://api.example.com/health # Expected: HTTP 200 OK
up{job="api-service"} # Expected: 1 for all instances
檢查錯誤率:當前錯誤百分比與按端點之分解
sum(rate(http_requests_total{status=~"5.."}[5m]))
/ sum(rate(http_requests_total[5m])) * 100 # Expected: < 1%
分析日誌:自 Loki 之近期錯誤與最高錯誤訊息
{job="api-service"} |= "error" | json | level="error"
檢查資源用量:CPU、記憶體與連線池狀態
avg(rate(container_cpu_usage_seconds_total{pod=~"api-service.*"}[5m])) * 100
# Expected: < 70%
審查近期變更:部署、git 提交、基礎設施變更
檢視依賴:下游服務健康、資料庫/API 延遲
失敗模式決策樹(節錄):
預期: 診斷程序具體,含預期對實際值,引導應變者完成調查。
失敗時:
5 種解決選項之完整命令與回滾程序見 Extended Examples。
記錄逐步補救與回滾選項。
五種解決選項(簡要摘要):
回滾部署(最快):對部署後錯誤
kubectl rollout undo deployment/api-service
驗證 → 監看 → 確認解決(錯誤率 < 1%、延遲正常、無警報)
擴容資源:對高 CPU/記憶體、連線池耗盡
kubectl scale deployment/api-service --replicas=$((current * 3/2))
重啟服務:對記憶體洩漏、卡住之連線、快取損毀
kubectl rollout restart deployment/api-service
功能旗標/熔斷器:對特定功能錯誤或外部依賴失敗
kubectl set env deployment/api-service FEATURE_NAME=false
資料庫補救:對資料庫連線、慢查詢、池耗盡
-- Kill long-running queries, restart connection pool, increase pool size
通用驗證清單:
回滾程序:若解決使情況惡化 → 暫停/取消 → 還原 → 重評估
預期: 解決步驟清晰,含驗證檢查,為各行動提供回滾選項。
失敗時:
完整升級層級與聯絡目錄範本見 Extended Examples。
定義何時、如何升級事件。
何時立即升級:
五個升級層級:
升級流程:
聯絡目錄:維持表,含角色、Slack、電話、PagerDuty,涵蓋:
預期: 升級之清晰準則、聯絡資訊隨手可得、升級路徑與組織結構對齊。
失敗時:
所有內部與外部範本及完整格式見 Extended Examples。
提供事件更新之預寫訊息。
內部範本(Slack #incident-response):
初始宣告:
🚨 INCIDENT: [Title] | Severity: [Critical/High/Medium]
Impact: [users/services] | Owner: @username | Dashboard: [link]
Quick Summary: [1-2 sentences] | Next update: 15 min
進度更新(每 15-30 分鐘):
📊 UPDATE #N | Status: [Investigating/Mitigating/Monitoring]
Actions: [what we tried and outcomes]
Theory: [what we think is happening]
Next: [planned actions]
緩解完成:
✅ MITIGATION | Metrics: Error [before→after], Latency [before→after]
Root Cause: [brief or "investigating"] | Monitoring 30min before resolved
解決:
🎉 RESOLVED | Duration: [time] | Root Cause + Impact + Follow-up actions
誤報:無影響,無需後續
外部範本(狀態頁):
客戶 email 範本:時間軸、影響描述、解決、預防、補償(若適用)
預期: 範本於事件中節省時間,確保一致溝通,降低應變者之認知負擔。
失敗時:
完整 Prometheus 警報配置與 Grafana 儀表板 JSON 見 Extended Examples。
將手冊與警報及儀表板整合。
將手冊連結加至 Prometheus 警報:
- alert: HighErrorRate
annotations:
runbook_url: "https://wiki.example.com/runbooks/high-error-rate"
dashboard_url: "https://grafana.example.com/d/service-overview"
incident_channel: "#incident-platform"
於手冊嵌入快速診斷連結:
建立 Grafana 儀表板面板,含手冊連結(markdown 面板列出所有事件手冊及值班與升級資訊)
預期: 應變者可自警報或儀表板直接存取手冊、診斷查詢已預填、相關工具一鍵存取。
失敗時:
configure-alerting-rules — 將手冊連結至警報註解,以於事件中立即存取build-grafana-dashboards — 於儀表板與診斷面板嵌入手冊連結setup-prometheus-monitoring — 將 Prometheus 之診斷查詢納入手冊程序define-slo-sli-sla — 於事件嚴重性分類中參照 SLO 影響