cloudflare / cloudflare/cloudflare-python
Add typed methods for Load Balancing Analytics Events and Pool Health endpoints
- Lenguaje dominante
- Python
- Estrellas
- 506
- Forks
- 148
- Merge medio
- 3 h 15 min
- PR fusionados (30 d)
- 1
Descripción
## Feature Request
The Python SDK is missing typed methods for two Load Balancing endpoints that are documented in the Cloudflare REST API:
### 1. Load Balancing Analytics Events
**REST endpoint:** `GET /accounts/{account_id}/load_balancing_analytics/events`
Returns per-origin health state change events with timestamps, pool health status, failure reasons, and response codes. This is critical for monitoring when individual origins go unhealthy.
**Current workaround:**
```python
resp = client.with_raw_response.get(
f"/accounts/{account_id}/load_balancing_analytics/events",
cast_to=object,
options={"params": {"per_page": 200, "page": 1, "since": "...", "until": "..."}}
)
data = resp.json()
```
**Desired:**
```python
events = client.load_balancers.analytics.events.list(
account_id=account_id,
since="2026-03-18T00:00:00Z",
until="2026-03-18T23:59:59Z",
)
```
### 2. Pool Health Details
**REST endpoint:** `GET /accounts/{account_id}/load_balancers/pools/{pool_id}/health`
Returns per-PoP, per-origin health status including response codes, RTT, and failure reasons. Useful for diagnosing which specific origins are failing and from which regions.
**Current workaround:**
```python
resp = client.with_raw_response.get(
f"/accounts/{account_id}/load_balancers/pools/{pool_id}/health",
cast_to=object,
)
data = resp.json()
```
**Desired:**
```python
health = client.load_balancers.pools.health.get(
pool_id=pool_id,
account_id=account_id,
)
```
### Use Case
We built an origin health monitor that detects when individual load balancer origins are unhealthy while the pool remains healthy (silent degradation / lost redundancy). Both endpoints are essential for this use case and are documented in the Cloudflare API docs, but require falling back to raw HTTP via `with_raw_response.get()`.
### References
- [Pool Health API docs](https://developers.cloudflare.com/api/resources/load_balancers/subresources/pools/subresources/health/methods/get/)
- [Load Balancing Analytics](https://developers.cloudflare.com/load-balancing/reference/load-balancing-analytics/)
Guía de contribución
Línea de trabajo
Comienza con los endpoints REST documentados y los puntos de entrada del cliente `load_balancers.analytics.events.list` y `load_balancers.pools.health.get`, y después compara los recursos tipados del SDK cercanos. Se considera terminado cuando ambos endpoints están disponibles mediante métodos tipados y exponen los campos documentados de eventos y de salud por origen, en lugar de requerir `with_raw_response.get()`.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- api, backend-api-design
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 58/100