davidcastagnetoa/skills

circuit_breaker_gateway

Abrir el circuito si un servicio downstream falla repetidamente para evitar cascada de errores

First seen Mar 2, 2026

Installation

$ npx skills add davidcastagnetoa/skills --skill circuit_breaker_gateway

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from davidcastagnetoa/skills · top by installs.

npx skills add davidcastagnetoa/skills

Browse all from davidcastagnetoa/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 1
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,962 B
  • docs SUMMARY.md 125 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 12 installs

SKILL.md

circuitbreakergateway

El circuit breaker en el gateway detecta cuando un microservicio downstream (livenessagent, facematch_agent, etc.) está fallando y deja de enviarle tráfico temporalmente. Esto previene que errores en un servicio saturen el gateway y degraden toda la experiencia.

When to use

Usar para todos los servicios upstream configurados en Nginx. Integrar con el health monitor para que el estado del circuito se refleje en los dashboards de Grafana.

Instructions

  1. Instalar en Python con tenacity para los clientes internos: pip install tenacity pybreaker
  2. Configurar circuit breaker en backend/core/circuit_breaker.py:

``python from pybreaker import CircuitBreaker livenessbreaker = CircuitBreaker(failmax=5, resettimeout=30) facematchbreaker = CircuitBreaker(failmax=5, resettimeout=30) @livenessbreaker async def calllivenessagent(payload): ... ``

  1. En Nginx, usar proxynextupstream error timeout http500 http502 http_503 para routing automático al siguiente upstream.
  2. Configurar proxyconnecttimeout 2s y proxyreadtimeout 10s — timeouts cortos evitan que un upstream lento colapse el gateway.
  3. Estado del circuito: CLOSED (normal) → OPEN (fallo, rechaza requests) → HALF-OPEN (prueba recuperación).
  4. Exponer estado del circuito como métrica Prometheus: circuitbreakerstate{service="liveness_agent"}.
  5. Alertar en Grafana si cualquier circuito lleva más de 60 segundos en estado OPEN.

Notes

  • fail_max=5 significa que tras 5 fallos consecutivos se abre el circuito.
  • reset_timeout=30 segundos en OPEN antes de probar HALF-OPEN.
  • Cuando el circuito está OPEN, devolver degraded response (no 500) — informar al cliente del estado parcial.