Skip to content

feat: gateway health monitoring#610

Open
vladimirvolek wants to merge 5 commits into
mainfrom
gateway-health
Open

feat: gateway health monitoring#610
vladimirvolek wants to merge 5 commits into
mainfrom
gateway-health

Conversation

@vladimirvolek

@vladimirvolek vladimirvolek commented Jul 15, 2026

Copy link
Copy Markdown
Member

resolves: #601

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blockfrost-platform-docs Ready Ready Preview, Comment Jul 15, 2026 1:30pm
blockfrost-platform-docs-next Ready Ready Preview, Comment Jul 15, 2026 1:30pm

Request Review

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 15, 2026

Copy link
Copy Markdown

Deploying blockfrost-platform with  Cloudflare Pages  Cloudflare Pages

Latest commit: 288f218
Status: ✅  Deploy successful!
Preview URL: https://9b0bf2ed.blockfrost-platform.pages.dev
Branch Preview URL: https://gateway-health.blockfrost-platform.pages.dev

View logs

Copilot AI 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.

Pull request overview

This PR adds a background health-monitoring loop to the blockfrost-gateway crate so GET / (and Prometheus metrics) reflect real service health, specifically PostgreSQL connectivity and Blockfrost API reachability, addressing issue #601.

Changes:

  • Introduces a HealthMonitor task that periodically pings PostgreSQL and the Blockfrost API and stores a current health snapshot.
  • Updates GET / to return 200 when healthy and 503 when unhealthy, including a list of health-check errors.
  • Adds a blockfrost_gateway_healthy gauge to GET /metrics and updates changelogs accordingly.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/gateway/src/main.rs Spawns HealthMonitor and injects it into Axum extensions.
crates/gateway/src/lib.rs Exposes the new health_monitor module.
crates/gateway/src/health_monitor.rs New background task that tracks DB/Blockfrost health and transitions.
crates/gateway/src/db.rs Adds DB::ping() via a trivial SELECT 1 with a timeout.
crates/gateway/src/blockfrost.rs Adds BlockfrostAPI::ping() using blocks_latest() with a timeout.
crates/gateway/src/api/root.rs Root endpoint now reflects actual health (status code + errors payload).
crates/gateway/src/api/metrics.rs Emits blockfrost_gateway_healthy gauge; updates tests accordingly.
crates/gateway/CHANGELOG.md Documents new metric and corrected GET / health behavior.
CHANGELOG.md Documents the same changes at the product level.

Comment thread crates/gateway/src/api/root.rs
Comment thread crates/gateway/src/api/root.rs
@vladimirvolek
vladimirvolek marked this pull request as ready for review July 15, 2026 13:42
@vladimirvolek vladimirvolek self-assigned this Jul 15, 2026
@vladimirvolek vladimirvolek changed the title feat: gateway health monitoring feat: Gateway health monitoring Jul 15, 2026
@vladimirvolek vladimirvolek changed the title feat: Gateway health monitoring feat: gateway health monitoring Jul 15, 2026
@vladimirvolek
vladimirvolek requested a review from michalrus July 16, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway: GET / shouldn’t always return healthy: true

2 participants