Skip to content

Commit 98a702e

Browse files
feat(observability): add docker-compose for prometheus/grafana and create L2 support playbook
1 parent e756b4c commit 98a702e

3 files changed

Lines changed: 90 additions & 0 deletions

File tree

SUPPORT_PLAYBOOK.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# BESSAI Support Playbook (L2)
2+
3+
Este Runbook proporciona instrucciones de triaje rápido para el equipo de nivel 2 (L2 Support) en operaciones de despliegue y contención de incidentes del Gateway BESSAI-Edge.
4+
5+
## 🛠 Diagnóstico: Alta Latencia (bess_fleet_latency_ms > 100ms)
6+
7+
**Síntoma:** Grafana dispara la alerta `HighFleetLatency` para un `site_id` específico.
8+
**Impacto:** Los setpoints del VPP están experimentando retrasos considerables, arriesgando multas del mercado si la latencia rebasa los tiempos de inercia inyectables.
9+
10+
### Pasos de Mitigación:
11+
1. **Verificar métricas en Grafana**:
12+
- Acudir al Dashboard `BESSAI Fleet Overview`.
13+
- Filtrar por `site_id` para aislar el nodo problemático.
14+
2. **Revisar logs de Pod**:
15+
```bash
16+
kubectl logs deployment/bessai-edge --tail=100 | grep -i "latency\|error\|timeout"
17+
```
18+
3. **Comprobar cuellos de botella CPU / I/O**:
19+
```bash
20+
kubectl top pods -n bessai-pilot
21+
```
22+
Si la CPU está por encima del 85%, el HPA está asfixiado.
23+
4. **Escalar manualmente (Mitigación Inmediata)**:
24+
Si HPA está atascado u oscilando:
25+
```bash
26+
kubectl scale deployment bessai-edge --replicas=6 -n bessai-pilot
27+
```
28+
29+
## 🔋 Diagnóstico: Aumento de Degradación (bess_battery_degradation)
30+
31+
**Síntoma:** El score de degradación en un sitio escala a >1% drásticamente en menos de 24 horas.
32+
**Causa probable:** Curva de despacho extrema desde el optimizador (SocSwing extremo repetitivo).
33+
### Acción L2:
34+
- Contactar de inmediato con Operaciones (Mercado Técnico).
35+
- Desactivar inyecciones en el bloque afectado mediante Dashboard para aislar celda.
36+
37+
---
38+
39+
## ✅ Checklist Pre-Despliegue
40+
41+
Antes de aplicar un nuevo `helm upgrade`, L2 o DevOps deben ratificar los siguientes checkpoints en `Staging`:
42+
43+
- [ ] Validar `bess_fleet_latency_ms` (p99) <100ms utilizando `analyze_locust.py`.
44+
- [ ] Confirmar `bess_battery_degradation` <1% en la simulación de pre-producción.
45+
- [ ] Revisar alertas preexistentes en Prometheus (`http://prometheus:9090/alerts`) que indiquen inestabilidad.
46+
- [ ] Asegurarse de que el `readinessProbe` local devuelve HTTP 200 en `/metrics`.

docker-compose.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: '3.8'
2+
3+
services:
4+
# BESSAI Edge Gateway (Multi-Worker Emulation)
5+
bessai-edge:
6+
build: .
7+
container_name: bessai-edge
8+
ports:
9+
- "8000:8000"
10+
deploy:
11+
replicas: 1 # Escalable en producción
12+
# Override the command to use multiple workers if gunicorn/uvicorn is added
13+
# command: ["gunicorn", "-w", "4", "-k", "aiohttp.GunicornWebWorker", "demo_server:app"]
14+
15+
# Prometheus TSDB
16+
prometheus:
17+
image: prom/prometheus:latest
18+
container_name: prometheus
19+
ports:
20+
- "9090:9090"
21+
volumes:
22+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
23+
24+
# Grafana Dashboard
25+
grafana:
26+
image: grafana/grafana:latest
27+
container_name: grafana
28+
ports:
29+
- "3000:3000"
30+
depends_on:
31+
- prometheus
32+
environment:
33+
- GF_SECURITY_ADMIN_USER=admin
34+
- GF_SECURITY_ADMIN_PASSWORD=admin

prometheus.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
global:
2+
scrape_interval: 5s
3+
evaluation_interval: 15s
4+
5+
scrape_configs:
6+
- job_name: 'bessai-edge'
7+
static_configs:
8+
- targets: ['bessai-edge:8000']
9+
labels:
10+
deployment: "local-pilot"

0 commit comments

Comments
 (0)