forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GraphQL] Add health endpoint (MystenLabs#18277)
## Description Adds a `checkpoint_timestamp_ms` to the watermark task and uses it in a new health check endpoint function. The health endpoint checks for two things - if there is a DB connection, otherwise it returns code 500 - if the last known checkpoint timestamp is within an acceptable buffer. It subtracts the current timestamp from the checkpoint timestamp, and checks if the value is larger than the provided query param `max_checkpoint_lag_ms` or a default value, and it returns code 504, GATEWAY TIMEOUT in that case. How to query this endpoint: `curl -X GET "http://127.0.0.1:8000/health" -i ` Set the check for max checkpoint time lag to 10s. If it returns 503, then the checkpoint is behind. `curl -X GET "http://127.0.0.1:8000/health?max_checkpoint_lag_ms=10000" -i` ## Test plan Added a new test. `cargo nextest run --features pg_integration -- test_health_check` --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK:
- Loading branch information
1 parent
0da3aef
commit 1094930
Showing
3 changed files
with
100 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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