feat: gateway health monitoring#610
Open
vladimirvolek wants to merge 5 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Deploying blockfrost-platform with
|
| Latest commit: |
288f218
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9b0bf2ed.blockfrost-platform.pages.dev |
| Branch Preview URL: | https://gateway-health.blockfrost-platform.pages.dev |
Contributor
There was a problem hiding this comment.
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
HealthMonitortask that periodically pings PostgreSQL and the Blockfrost API and stores a current health snapshot. - Updates
GET /to return200when healthy and503when unhealthy, including a list of health-check errors. - Adds a
blockfrost_gateway_healthygauge toGET /metricsand 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. |
vladimirvolek
marked this pull request as ready for review
July 15, 2026 13:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves: #601