--- id: wiki-2026-0508-sre title: SRE category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Site Reliability Engineering, production engineering] duplicate_of: none source_trust_level: A confidence_score: 0.95 verification_status: applied tags: [sre, reliability, slo, observability, devops] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: multi framework: prometheus-grafana-opentelemetry --- # SRE ## 매 한 줄 > **"매 reliability 의 feature 의 — 매 first feature 의"**. SRE (Site Reliability Engineering) 의 Google-originated discipline 의 software engineering 의 ops 의 applying. 핵심: SLOs 의 define, error budgets 의 enforce, toil 의 eliminate, blameless postmortems. ## 매 핵심 ### 매 SRE 의 핵심 의 concepts - **SLI**: 매 measurement (e.g., 200-OK rate over 5min). - **SLO**: 매 target (e.g., 99.9% over 28d rolling). - **SLA**: 매 customer contract (with $ penalty). - **Error budget**: 매 100% - SLO. 매 budget 의 burn 시 release freeze. ### 매 four golden signals (Google) - Latency, Traffic, Errors, Saturation. ### 매 응용 1. SLO-driven alerting (multi-window burn rate). 2. Toil budget (≤50% of SRE time). 3. Blameless postmortem culture. ## 💻 패턴 ### Prometheus SLO recording rules ```yaml groups: - name: slo.rules interval: 30s rules: - record: api:availability:ratio_rate5m expr: | sum(rate(http_requests_total{job="api",code!~"5.."}[5m])) / sum(rate(http_requests_total{job="api"}[5m])) - record: api:availability:ratio_rate1h expr: | sum(rate(http_requests_total{job="api",code!~"5.."}[1h])) / sum(rate(http_requests_total{job="api"}[1h])) ``` ### Multi-window multi-burn-rate alert ```yaml - alert: ApiErrorBudgetFastBurn expr: | (1 - api:availability:ratio_rate5m) > (14.4 * 0.001) and (1 - api:availability:ratio_rate1h) > (14.4 * 0.001) for: 2m labels: { severity: page } annotations: summary: "Fast burn — 매 2% budget 의 1h 의 consume 의" ``` ### OpenTelemetry instrumentation (Node) ```typescript import { NodeSDK } from '@opentelemetry/sdk-node'; import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'; import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'; new NodeSDK({ traceExporter: new OTLPTraceExporter({ url: process.env.OTEL_ENDPOINT }), instrumentations: [getNodeAutoInstrumentations()], }).start(); ``` ### Runbook automation (Python) ```python import kubernetes.client as k8s def remediate(pod_name: str, ns: str): api = k8s.CoreV1Api() api.delete_namespaced_pod(pod_name, ns) notify_slack(f"매 auto-restart {ns}/{pod_name} (high mem)") ``` ### Postmortem template ```markdown # Incident YYYY-MM-DD: