Skip to content

Refactor/endpoint health api#311

Merged
IonesioJunior merged 4 commits intomainfrom
refactor/endpoint-health-api
Mar 6, 2026
Merged

Refactor/endpoint health api#311
IonesioJunior merged 4 commits intomainfrom
refactor/endpoint-health-api

Conversation

@shubham3121
Copy link
Member

This pull request introduces a new per-endpoint health reporting API to improve health monitoring and deprecates the legacy heartbeat endpoints. The changes add new database fields and schemas for storing client-reported health status, update repository and service logic to support bulk health updates, and mark old heartbeat-related code as deprecated. These updates pave the way for more granular and scalable health checks, while maintaining backward compatibility during the transition.

New Endpoint Health Reporting API:

  • Added POST /endpoints/health API endpoint for clients to report health status for multiple endpoints, including schemas EndpointHealthRequest and EndpointHealthResponse for request and response validation. [1] [2] [3]
  • Introduced new database fields to EndpointModel for storing per-endpoint health status (health_status, health_checked_at, health_ttl_seconds).
  • Updated endpoint schemas (Endpoint, EndpointResponse, EndpointPublicResponse) to expose health status fields in API responses. [1] [2] [3]

Repository and Service Enhancements:

  • Added repository methods for bulk health updates and endpoint lookup by slug, supporting the new health reporting workflow.
  • Extended EndpointService to handle the new health reporting logic, including TTL capping and domain heartbeat subsumption. [1] [2]

Deprecation and Backward Compatibility:

  • Marked legacy heartbeat endpoints and related fields as deprecated, added documentation and migration guidance in code comments and schemas. [1] [2] [3] [4] [5] [6] [7] [8]

Other Improvements:

  • Added EndpointHealthStatus enum for standardized health values.
  • Updated configuration comments for heartbeat TTL settings to clarify their deprecated status and future migration plan.

These changes enable granular endpoint health tracking, simplify future health monitoring, and ensure a smooth migration from legacy heartbeat APIs.

…orting

Add a new API endpoint that accepts granular per-endpoint health status
from clients, replacing the domain-level heartbeat as the primary health
signal. The health monitor is simplified to a 2-tier approach: per-endpoint
health (priority 1) with heartbeat as a deprecated fallback (priority 2).

- Add health_status, health_checked_at, health_ttl_seconds to EndpointModel
- Add POST /endpoints/health route with bulk slug matching and TTL capping
- Add EndpointHealthRequest/Response schemas and repository methods
- Simplify health monitor: remove HTTP fallback, extract modular tier methods
- Add deprecation notes to heartbeat endpoints, services, schemas, and models
- Add alembic migration for new nullable endpoint health columns
@IonesioJunior IonesioJunior merged commit f9673d3 into main Mar 6, 2026
25 checks passed
@IonesioJunior IonesioJunior deleted the refactor/endpoint-health-api branch March 9, 2026 21:16
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.

2 participants