Skip to content

[Merged by Bors] - Update node health endpoint #4310

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

Closed
wants to merge 17 commits into from

Conversation

eserilev
Copy link
Member

@eserilev eserilev commented May 21, 2023

Issue Addressed

#4292

Proposed Changes

Updated the node health endpoint

will return a 200 status code if !syncing && !el_offline && !optimistic

wil return a 206 if (syncing || optimistic) && !el_offline

will return a 503 if el_offline

Additional Info

let unhealthy = is_syncing || Some(is_optimistic) || Some(el_offline);

if (unhealthy) {
Err(warp_utils::reject::not_synced(format!(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could have returned a different error message for each situation where unhealthy resolves to true, but im not sure how helpful that is

@eserilev eserilev closed this May 21, 2023
@eserilev eserilev reopened this May 21, 2023
@eserilev
Copy link
Member Author

eserilev commented May 21, 2023

test_get_node_health is failing. will need to figure out how to get that test to pass (assuming my implementation is correct)

@paulhauner paulhauner added the work-in-progress PR is a work-in-progress label May 22, 2023
@paulhauner
Copy link
Member

Thanks for your contribution. I'd like to note that the Beacon-API specs state that:

206 Node is syncing but can serve incomplete data

So, moving to a NotSynced (503) would be going against the spec. I'm also not sure it's clear that syncing node is necessarily unhealthy. For example, a newly provisioned node that is syncing is "healthy" in the sense that it's working as intended and requires no intervention.

Fine-grained information is available at node/syncing.

I do agree that a node with a ee_offline is unhealthy, though. I'd be open to seeing an error returned when ee_offline == true.

@michaelsproul
Copy link
Member

Yeah my bad, I didn't distinguish between syncing and EL offline in the original issue. I agree we should return a 206 for syncing/optimistic, and a 503 for el_offline.

@eserilev
Copy link
Member Author

thanks for the feedback!

let mock_el = harness.mock_execution_layer.as_ref().unwrap();

// EL not synced
mock_el.server.set_syncing_response(Ok(true));
Copy link
Member Author

@eserilev eserilev May 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test currently fails. I'm trying to test the situation where the node is syncing and the endpoint returns a 206 status code. However i'm not really sure how to mock syncing to true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelsproul ideally i'd like to test the situation where the node health endpoint returns a 206, but I'm struggling trying to find a way to mock the situation where the node is syncing/optimistic

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can call mock_el.server.all_payloads_syncing(true), then add a block (e.g. with extend_chain). That new block will result in a SYNCING status from the EL on newPayload, which will put Lighthouse into optimistic sync

@michaelsproul michaelsproul added waiting-on-author The reviewer has suggested changes and awaits thier implementation. v4.3.0 Estimated Q2 2023 labels May 30, 2023
@eserilev
Copy link
Member Author

@michaelsproul thanks for the feedback and help. this should be ready for another review

@michaelsproul michaelsproul added ready-for-review The code is ready for review and removed work-in-progress PR is a work-in-progress waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels May 30, 2023
@michaelsproul michaelsproul added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Jun 27, 2023
Copy link
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@michaelsproul michaelsproul added ready-for-merge This PR is ready to merge. and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Jun 29, 2023
@paulhauner
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Jun 30, 2023
## Issue Addressed

[#4292](#4292)

## Proposed Changes

Updated the node health endpoint

will return a 200 status code if  `!syncing && !el_offline && !optimistic`

wil return a 206 if `(syncing || optimistic) &&  !el_offline`

will return a 503 if `el_offline`



## Additional Info
@bors
Copy link

bors bot commented Jun 30, 2023

@bors bors bot changed the title Update node health endpoint [Merged by Bors] - Update node health endpoint Jun 30, 2023
@bors bors bot closed this Jun 30, 2023
ghost pushed a commit to oone-world/lighthouse that referenced this pull request Jul 13, 2023
## Issue Addressed

[sigp#4292](sigp#4292)

## Proposed Changes

Updated the node health endpoint

will return a 200 status code if  `!syncing && !el_offline && !optimistic`

wil return a 206 if `(syncing || optimistic) &&  !el_offline`

will return a 503 if `el_offline`



## Additional Info
Woodpile37 pushed a commit to Woodpile37/lighthouse that referenced this pull request Jan 6, 2024
## Issue Addressed

[sigp#4292](sigp#4292)

## Proposed Changes

Updated the node health endpoint

will return a 200 status code if  `!syncing && !el_offline && !optimistic`

wil return a 206 if `(syncing || optimistic) &&  !el_offline`

will return a 503 if `el_offline`



## Additional Info
Woodpile37 pushed a commit to Woodpile37/lighthouse that referenced this pull request Jan 6, 2024
[sigp#4292](sigp#4292)

Updated the node health endpoint

will return a 200 status code if  `!syncing && !el_offline && !optimistic`

wil return a 206 if `(syncing || optimistic) &&  !el_offline`

will return a 503 if `el_offline`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge This PR is ready to merge. v4.3.0 Estimated Q2 2023
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants