Skip to content

feat(#770): add provider health registry and degradation status - #896

Open
frankrichard99 wants to merge 1 commit into
Pulsefy:mainfrom
frankrichard99:feat/770-provider-health-registry
Open

feat(#770): add provider health registry and degradation status#896
frankrichard99 wants to merge 1 commit into
Pulsefy:mainfrom
frankrichard99:feat/770-provider-health-registry

Conversation

@frankrichard99

Copy link
Copy Markdown

Closes #770

This PR adds a centralized provider health registry that tracks recent failures
and exposes degraded/fallback status without leaking sensitive details.

New files:

  • services/provider_health.py — Thread-safe health registry with rolling-window
    failure tracking, circuit-breaker integration, and aggregate status computation
  • api/v1/health.py — Two endpoints: public /v1/ai/health/providers (no secrets)
    and operator /v1/ai/health/providers/detail (with internal counters)
  • tests/test_provider_health.py — 20+ tests covering recording, circuit states,
    error rates, rolling windows, thread safety, clear/reset
  • tests/test_health_endpoint.py — 15+ tests covering endpoint shape, secret
    leakage prevention, degraded/down states, recovery, detail endpoint

Modified files:

  • api/v1/router.py — Wired health router into v1
  • services/providers.py — Records failures/successes during LLM calls
  • metrics.py — Added provider health gauges/counters

Test results: All new and existing tests pass.

- Add ProviderHealthRegistry with rolling-window failure tracking
- Add /v1/ai/health/providers public endpoint (no secrets leaked)
- Add /v1/ai/health/providers/detail operator endpoint
- Integrate health recording into OpenAI/Groq provider calls
- Add provider health Prometheus metrics
- Cover provider-down and recovery behavior with tests

Closes Pulsefy#770
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@frankrichard99 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Cedarich Cedarich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly fix workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Provider Health Registry and Degradation Status

2 participants