Skip to content
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

Better handling of common errors when measuring peer count in eth1 #42

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

oleg-ssvlabs
Copy link
Contributor

@oleg-ssvlabs oleg-ssvlabs commented Nov 25, 2024

Some Execution Clients do not support (or may have optionally disabled) the endpoint that provides the number of peers. This happens fairly often, and the previous implementation would output a peer count of 0 in such cases, which is misleading. This PR addresses the issue by outputting a custom error message to clarify the Unhealthy status. While we could potentially clear the Unhealthy status, doing so would require additional implementation and might complicate the code. For now, this solution should be sufficient.

New:
image

Old:
image

@@ -20,10 +20,13 @@ const (
PeerCountMeasurement = "Count"
)

var measuringErr = errors.New("UNABLE_TO_MEASURE")
Copy link

@vaclav-ssvlabs vaclav-ssvlabs Nov 25, 2024

Choose a reason for hiding this comment

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

golang best practice for predefined errors is to store them in separate files like error.go, but it isn't a blocker

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see your point. I would say it's pretty common to declare errors in the file with some other objects. It depends on the size of the file or package, etc. If there are more package level errors, then we can move it to a separate file. Good suggestion

@oleg-ssvlabs oleg-ssvlabs merged commit ebefa81 into main Nov 25, 2024
4 checks passed
@oleg-ssvlabs oleg-ssvlabs deleted the exec-client-metric-error-handling branch November 25, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants