-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Implement Health Endpoint
Description
Implement the /health endpoint to monitor the health status of the Tezos RPC node. The endpoint should return a 200 OK status if all the following heuristics pass, and a 500 status if any of them fail:
- The
bootstrappedproperty from the/chains/<chain_id>/is_bootstrappedendpoint must betrue. - The
syncedproperty from the/chains/<chain_id>/is_bootstrappedendpoint must besynced. - The sidecar must observe a new block emitted from the
/monitor/heads/<chain_id>endpoint withinN + minimal_block_delayseconds.
Tasks
- Create a
/healthendpoint- Define the endpoint route
- Implement the logic to return 200 OK or 500 status based on heuristics
- Monitor the
/chains/<chain_id>/is_bootstrappedendpoint- Fetch the
bootstrappedproperty - Fetch the
syncedproperty
- Fetch the
- Observe new blocks from
/monitor/heads/<chain_id>within the configured time window- Fetch and check new block emission
- Fetch the
minimal_block_delayfrom the/chains/<chain_id>/blocks/head/context/constantsendpoint when a new chain is detected- Store and update the
minimal_block_delayconstant
- Store and update the
- Monitor for changes in the protocol and update the
minimal_block_delayconstant from the constants RPC when the protocol changes - Make the
additional-time-windowvalue configurable via a command line flag (default to 10 seconds)- Implement command line flag parsing
- Apply the configurable time window in block observation
- Log errors when they occur
- Define error logging format
- Implement error logging
- Optionally log HTTP requests to the
/healthendpoint (enabled by default)- Implement request logging
- Make logging configurable
- Log all underlying heuristic checks that fail when the health check returns negative
- Implement detailed logging for failed heuristic checks
- Create unit and integration tests
- Write tests for each heuristic
- Write tests for error handling
- Update documentation
- Update README to reflect the new
/healthendpoint functionality
- Update README to reflect the new
Acceptance Criteria
- The
/healthendpoint returns 200 OK when all heuristics pass. - The
/healthendpoint returns 500 when any heuristic fails. - Errors are logged as specified.
- HTTP requests to the
/healthendpoint are logged by default. - Failed heuristic checks are logged in detail when the health check returns negative.
- Tests are implemented and passing.
- Documentation is updated to reflect the new feature.
Notes
- The sidecar should fetch the active chain ID once from the
/monitor/active_chainsendpoint and assume it does not change. - Ensure that the health checks are efficient and do not overload the Tezos RPC node.
- Implement logging for error conditions and optionally for all HTTP requests to the
/healthendpoint.
GImbrailo
Metadata
Metadata
Assignees
Labels
No labels