Our current health check endpoint doesn't check anything and always returns 200 as soon the service is up. That doesn't mean the service can actually relay transactions.
We need to implement a new status page & better alerting that will display health per chain, because our production bundlers are shared - they support multiple networks - so we need to know which networks are operating correctly and which have errors
We also don't have a /info endpoint that returns data about the currently running bundler instance - such as it's currently active relayer addresses.
Implemented a new /admin/health/:chainId? endpoint. Note that the chainId is optional, if you don't provide it, it will run checks for all supported chains and return an array of status results.
Implemented a new /admin/info endpoint that returns some basic information about the currently running bundler instance. At the moment it returns only data about the relayers, but it can easily be extended to return anything else.
How Has This Been Tested?
Some unit tests exist for the /health handler and the status service health-related functions. It's not completely covered by tests, I just wrote tests for what I deemed to be important.
Other than that I tested both endpoints manually with curl and I tried breaking various dependencies to see how it would react.
{
"chainId": 80002,
"healthy": true,
"errors": ["Redis is not working as expected"],
"latencies": {
"mongo": 0.009837333,
"simulator": 0.008266167,
"rpc": 0.438564875,
"relayers": 0.477082875,
"redis": 46.763403313,
"gasPrice": 47.361171064,
"total": 47.363006646
}
}
π How do I review this?
You can run the tests related to this PR with:
yarn test -t StatusService
yarn test -t /health/:chainId (literally copy this sting, don't replace :chainId with a number)
Also it's useful if you run the service locally and manually send a health check request with
curl localhost:3000/admin/health/<your chainId> - make sure you specify a chainId that's actually enabled on your local bundler instance, or you will receive a "chain ID not supported" error.
π Context
Type of change
Why are we doing this?
/info
endpoint that returns data about the currently running bundler instance - such as it's currently active relayer addresses.Related issues:
What did we do?
/admin/health/:chainId?
endpoint. Note that the chainId is optional, if you don't provide it, it will run checks for all supported chains and return an array of status results./admin/info
endpoint that returns some basic information about the currently running bundler instance. At the moment it returns only data about the relayers, but it can easily be extended to return anything else.How Has This Been Tested?
/health
handler and the status service health-related functions. It's not completely covered by tests, I just wrote tests for what I deemed to be important.curl
and I tried breaking various dependencies to see how it would react./health/80002
π How do I review this?
You can run the tests related to this PR with:
yarn test -t StatusService
yarn test -t /health/:chainId
(literally copy this sting, don't replace :chainId with a number)Also it's useful if you run the service locally and manually send a health check request with
curl localhost:3000/admin/health/<your chainId>
- make sure you specify a chainId that's actually enabled on your local bundler instance, or you will receive a "chain ID not supported" error.