SLO & SLA
Objectif & portée¶
- Définir SLI/SLO officiels et SLA commerciaux pour SalamBot
- Couverture: API v1, webhooks, canaux (webchat, Facebook, WhatsApp)
- Fuseau: UTC+1 (Maroc)
Définitions¶
- SLI: indicateur mesuré (latence, dispo, erreurs)
- SLO: objectif d'un SLI (ex: p95 ≤ 500ms)
- SLA: engagement client (dispo mensuelle + crédits)
- Error budget: 1 − SLO; Burn rate: vitesse de consommation
SLI officiels¶
| SLI | Description | Source | Agrégat | Labels | Fenêtre |
|---|---|---|---|---|---|
| Disponibilité API | 1 − (5xx)/total | gateway http_requests_total | ratio | tenant,endpoint,status | 30 j roulants |
| Ingestion p95 | gateway_in → orchestrateur_in | salambot_ingest_duration_seconds | p95 | tenant,channel | 5m alert / 30j |
| NLU p95 | latence NLU | salambot_nlu_duration_seconds | p95 | tenant,model | 5m/30j |
| Retrieval p95 | latence RAG | salambot_retrieval_duration_seconds | p95 | tenant | 5m/30j |
| TTFB p95 | POST → 1er event SSE | salambot_ttfb_seconds | p95 | tenant,channel | 5m/30j |
| E2E p95 | demande → réponse | salambot_e2e_duration_seconds | p95 | tenant,channel | 5m/30j |
Notes :
- Exclure 4xx du calcul d'erreur. La disponibilité est calculée sur les 5xx ; les timeouts ne sont pas inclus par défaut (sauf métrique dédiée).
Cibles SLO¶
Latence (p95)¶
| Composant | Objectif |
|---|---|
| Ingestion | ≤150ms |
| NLU | ≤200ms |
| Retrieval | ≤500ms |
| TTFB | ≤600ms |
| E2E | ≤2500ms |
Disponibilité mensuelle¶
| Palier | Objectif |
|---|---|
| Gold | 99.9% |
| Silver | 99.5% |
| Bronze | 99.0% |
Mesure & instrumentation¶
- Tracing OpenTelemetry → Prometheus
- Propager: trace_id, span_id, correlation_id, X-Request-Id
- Labels requis: tenant, channel, endpoint, status
- TTFB mesuré au 1er token/event SSE
Formules (PromQL)¶
Disponibilité API :
1 - (
sum(rate(http_requests_total{job="gateway",status=~"5.."}[30d])) /
sum(rate(http_requests_total{job="gateway"}[30d]))
)
Latence E2E p95 :
histogram_quantile(0.95,
sum by (le) (rate(salambot_e2e_duration_seconds_bucket[5m]))
)
Alerting par burn rate¶
- SLO 99.9% (budget 0.1%): P0 si BR>14.4/1h ET >6/6h
- SLO 99.5% (budget 0.5%): P1 si BR>6/1h ET >3/6h
Exemple de règle :
groups:
- name: slo.availability.gold
rules:
- alert: SLOBurnRateFast
expr: slo_error_ratio_1h > 0.001*14.4 and slo_error_ratio_6h > 0.001*6
for: 5m
labels: { severity: p0 }
annotations: { summary: 'SLO 99.9% burn rate élevé' }
SLA commerciaux¶
| Offre | Dispo | Crédit | Support |
|---|---|---|---|
| Gold | 99.9% | 10% si <99.9%; 25% si <99.5% | 24/7 ≤15 min |
| Silver | 99.5% | 5% si <99.5%; 15% si <99.0% | J+1 ouvré |
| Bronze | 99.0% | 5% si <99.0% | Heures ouvrées |
Conditions :
- Maintenances annoncées ≥72h, ≤2h/mois, exclues si communiquées
- Crédits déduits de la facture suivante
Gouvernance¶
- Revue mensuelle SLO/SLA par Platform Team
- Versionner les changements et notifier clients
- Aligner avec runbooks.md (mode dégradé) et quality.md
Annexes¶
- Budgets d'erreur (30 j): 99.9% = 43m12s; 99.5% = 3h36m; 99.0% = 7h12m
- Conformité CNDP/RGPD: pas de PII dans labels/logs
Références croisées :
Ops/runbooks.mdAPI/reference.mdQuality/quality.md