Senior sre

From ricardonevesbraga/flowgrammers-skills · View interactive version

Senior sre is an AI agent skill from the GitHub repository ricardonevesbraga/flowgrammers-skills. Site Reliability Engineer sênior especializado em SLI/SLO/SLA, error budgets, observabilidade, postmortems sem culpa, capacity planning, chaos engineering, incident management e toil reduction. Use ao definir SLOs, estruturar on-call, responder a incidentes, conduzir postmortems, projetar sistemas r

How to use this skill

Skill file

Site Reliability Engineer Sênior

Frameworks SRE (Google-style) adaptados para empresas brasileiras: SLO-driven reliability, error budgets, postmortems blameless, toil reduction e chaos engineering.

Palavras-chave

SRE, site reliability, SLI, SLO, SLA, error budget, postmortem, blameless, on-call, incident management, incident commander, chaos engineering, toil, capacity planning, observability, DORA metrics

Responsabilidades Principais

1. SLI/SLO/SLA (definição em camadas)

SLI (Service Level Indicator) — o que você mede

SLO (Service Level Objective) — meta interna

SLA (Service Level Agreement) — promessa contratual com cliente

Regra-chave: SLO é uma decisão de negócio, não técnica. Pergunte "o cliente percebe a diferença entre 99.9% e 99.99%?" Se não, economize milhões.

2. Error Budget

Se SLO = 99.9%, error budget = 0.1% do período.

Policy típica:

# error-budget-policy.yaml
service: checkout-api
slo: 99.9%
window: 30d
thresholds:
  green: ">= 50%"
  yellow: "20% - 50%"
  red: "< 20%"
  exhausted: "< 0%"
actions:
  green:
    - normal_velocity
  yellow:
    - reduce_deploy_frequency
    - require_sre_review
  red:
    - freeze_non_critical_features
    - weekly_reliability_reviews
  exhausted:
    - full_feature_freeze
    - daily_war_room

3. Observabilidade (Three Pillars + Traces + Profiling)

Stack mínimo (2026):

Dashboards por serviço (Golden Signals):

  1. Latency (distribuição, não média — use p50/p95/p99)
  2. Traffic (RPS, throughput)
  3. Errors (rate + %)
  4. Saturation (CPU, memória, conexões, queue depth)

Alertas — SEMPRE:

# alert.yaml — Burn rate alert
alert: CheckoutAPIErrorBudgetBurnRate
expr: |
  (
    error_budget_burn_rate_5m > 14.4
    AND error_budget_burn_rate_1h > 14.4
  ) OR (
    error_budget_burn_rate_30m > 6
    AND error_budget_burn_rate_6h > 6
  )
severity: page
runbook: https://docs/runbooks/checkout-api-errors

4. Incident Management

Estrutura de resposta:

Severidades:

| Sev | Impacto | Resposta |

|-----|---------|----------|

| 1 | Produção derrubada, receita parada | Imediata, war room |

| 2 | Funcionalidade crítica degradada | Em horário, < 1h |

| 3 | Degradação parcial | Em horário, < 4h |

| 4 | Incomodo menor | Em backlog |

Timeline de um SEV1:

5. Postmortem Blameless

Template:

# Postmortem: Incidente CHK-2026-04-15

## Resumo
- **Data**: 2026-04-15 14:23 BRT — 2026-04-15 15:47 BRT
- **Duração**: 1h 24min
- **Impacto**: 100% de falhas no checkout para ~12k usuários
- **Severidade**: SEV1

## Timeline
| Hora | Evento |
|------|--------|
| 14:23 | Deploy v2.4.0 iniciado |
| 14:24 | Alerta burn rate 5m disparado |
| 14:28 | IC declarado, rollback iniciado |
| 14:42 | Rollback completo, recuperação parcial |
| 15:47 | Recuperação total confirmada |

## Causa Raiz
Migração de schema adicionou NOT NULL em coluna `session_id`, mas rollout do backend precedeu migração. Durante janela de 20 min, INSERTs falharam com `null value in column "session_id"`.

## O Que Funcionou
- Alerta de burn rate disparou em 1 minuto
- Rollback automático estava configurado

## O Que Não Funcionou
- Ordem de migração não estava documentada
- Canary deploy só cobria 1% por 5min (insuficiente)

## Ações
| # | Ação | Dono | Prazo | Prioridade |
|---|------|------|-------|------------|
| 1 | Forçar migrations antes de backend em CI | SRE | 2026-04-25 | P0 |
| 2 | Aumentar canary para 10min em serviços críticos | Platform | 2026-05-10 | P1 |
| 3 | Runbook de incidents de schema | SRE | 2026-05-15 | P2 |

## Lições Aprendidas
Um princípio emergiu: "deploys de schema e código são acoplados; trate como uma unidade."

Regras:

6. Toil Reduction

Toil = trabalho operacional manual, repetitivo, automatizável, sem valor duradouro.

Alvo SRE canônico: < 50% do tempo em toil.

Identificação:

Strategy:

  1. Medir (timesheet ou ticket analysis)
  2. Categorizar (reactive vs. proactive)
  3. Priorizar por frequência × duração
  4. Automatizar top 3 por quarter
  5. Medir redução trimestralmente

7. Capacity Planning

Fórmula:

Capacidade = Baseline × (1 + crescimento_anual) × fator_segurança

Ex: 10k RPS atual × (1 + 0.6) × 1.5 = 24k RPS de capacidade planejada

Inputs:

Outputs:

8. Chaos Engineering

Princípios:

Ferramentas:

Experimentos iniciais:

Métricas do SRE (DORA + SRE)

| Métrica | Elite | High | Medium |

|---------|-------|------|--------|

| Deploy frequency | múltiplos/dia | 1x/dia | 1x/semana |

| Lead time for changes | < 1h | < 1 dia | < 1 semana |

| MTTR | < 1h | < 1 dia | < 1 semana |

| Change failure rate | < 15% | 16-30% | 16-30% |

Outras:

Perguntas-Chave que um SRE Faz

Veja Também

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.