-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Health endpoint #836
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #836 +/- ##
==========================================
+ Coverage 60.62% 60.65% +0.03%
==========================================
Files 215 218 +3
Lines 23099 23229 +130
==========================================
+ Hits 14003 14089 +86
- Misses 7947 7984 +37
- Partials 1149 1156 +7 ☔ View full report in Codecov by Sentry. |
do we have any tests for this new endpoint ? |
b124448
to
710e6c6
Compare
710e6c6
to
ed0097c
Compare
api/admin/admin.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The admin endpoints were buckled in this package and reformatted to follow the same pattern as other endpoints
api/admin_server.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially, this can live in the init functions of the thor and thor-solo ?
Edit: nvm: looks like it has 503, wasn't seeing it in testing locally |
Yeah, @darrenvechain is right, it's going to be useless as far as the AWS ALB is concerned if it doesn't return a 5XX status code when the node is unhealthy. I understand this is unfortunate and counter intuitive, but unless you build it like that I have to implement some sort of wrapper, which is the exact thing we're trying to replace. Tagging @otherview for visibility. Note that I mentioned this constraint in the related issue. |
I understand what you mean, it's the regular and expected behaviour to sync to the lastest block. This is the standard I've seen in other nodes, as it helps node operators to know when the node is 100% ready to process blockchain operations. |
Yeah I got you covered :) It's returning a 503 when |
885ddd5
to
17c2ce9
Compare
I would suggest to only leverage best block's timestamp in this function. |
health/health.go
Outdated
func New(repo *chain.Repository, p2p *comm.Communicator, timeBetweenBlocks time.Duration) *Health { | ||
return &Health{ | ||
repo: repo, | ||
timeBetweenBlocks: timeBetweenBlocks + delayBuffer, | ||
p2p: p2p, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored the health service to accept components and work in a pull fashion.
I think it looks better, thanks guys 🙏
e14ff2f
to
05e7dbf
Compare
* fix(documentation): use absolute links in markdown (#889) * Add benchmark test to node block process (#892) * Add benchmark test to node block process * added file-based storage * use tempdir * update dependency go-ethereum (#895) * chore: update API metrics bucket and endpoint names (#893) * chore: update API metrics bucket and endpoint names * fix: typo & tests * fix: lint * chore: add websocket total counter * fix: txs endpoints names & ws subject * fix: unit tests * chore: standardise naming convention * chore: add websocke duration & http code * chore: add websocke duration & http code * fix: lint issues * fix: sync issues with metrics * chore: update websocket durations bucket * fix: PR comments - use sync.Once * chore: update builtin generation (#896) * chore: update builtin generation * fix: update GHA * getreceipts metrics + lint (#902) * chore: add flag to enable/disable deprecated APIs (#897) * chore: add flag to enable/disable deprecated APIs * chore: update for PR comments * chore: update for PR comments * fix: update e2e commit sha * fix: update e2e commit sha * fix: update flag name * fix: solo start flags (#906) * chore: make thorclient configurable + fix type error (#908) * chore: make thorclient configurable * fix: subscriptions block type * fix: compile errors * fix: remove test with lint error * add 'raw' query parameter to the blocks (#899) * add 'raw' query parameter to the blocks * summary -> summary.Header Co-authored-by: libotony <[email protected]> * change variable name * make expanded and raw mutually exclusive * add unit tests * fix linting --------- Co-authored-by: libotony <[email protected]> * Adding Health endpoint (#836) * Adding Health endpoint * pr comments + 503 if not healthy * refactored admin server and api + health endpoint tests * fix health condition * fix admin routing * added comments + changed from ChainSync to ChainBootstrapStatus * Adding healthcheck for solo mode * adding solo + tests * fix log_level handler funcs * refactor health package + add p2p count * remove solo methods * moving health service to api pkg * added defaults + api health query * pr comments * pr comments * pr comments * Update cmd/thor/main.go * Darren/admin api log toggler (#877) * Adding Health endpoint * pr comments + 503 if not healthy * refactored admin server and api + health endpoint tests * fix health condition * fix admin routing * added comments + changed from ChainSync to ChainBootstrapStatus * Adding healthcheck for solo mode * adding solo + tests * fix log_level handler funcs * feat(admin): toggle api logs via admin API * feat(admin): add license headers * refactor health package + add p2p count * remove solo methods * moving health service to api pkg * added defaults + api health query * pr comments * pr comments --------- Co-authored-by: otherview <[email protected]> * Darren/chore/backport metrics (#909) * chore(muxdb): backport muxdb cache metrics * chore(muxdb): backport muxdb cache metrics * chore(metrics): backport disk IO * chore(metrics): fix lint * chore(chain): add repo cache metrics * fix(chain): fix cache return value * refactor(chain): cache hit miss * chore(thor): update version (#912) * chore(thor): update version * chore(openapi): version * feat(api/debug): support debug trace without blockId (#905) * api/debug: support debug with txhash Signed-off-by: jsvisa <[email protected]> api/debug: blockId should use tx's instead Signed-off-by: jsvisa <[email protected]> fix tests Signed-off-by: jsvisa <[email protected]> * debug: add test Signed-off-by: jsvisa <[email protected]> * improve parseTarget Signed-off-by: jsvisa <[email protected]> * update doc Signed-off-by: jsvisa <[email protected]> * fix tests Signed-off-by: jsvisa <[email protected]> --------- Signed-off-by: jsvisa <[email protected]> Co-authored-by: tony <[email protected]> * version --------- Signed-off-by: jsvisa <[email protected]> Co-authored-by: Darren Kelly <[email protected]> Co-authored-by: libotony <[email protected]> Co-authored-by: YeahNotSewerSide <[email protected]> Co-authored-by: Delweng <[email protected]>
Description
A health check service that lives inside the node as an API endpoint.
I think it's a good illustrative start for a PR, there are a few tech choices made that I consider would be worth discussing, such as:
Fixes # (issue)
Type of change
Please delete options that are not relevant.
Checklist: