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 error handling for 'Peers' metric in all groups #22

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

oleg-ssvlabs
Copy link
Contributor

Background:

In some scenarios, we encountered error responses in the “Peers” metric, but the error logs did not specify the issue. There were two problems:

  • Not handling the deserialization (unmarshalling) error correctly
  • Not checking the response content type, instead assuming it was a JSON response

This implementation addresses the issue and improves the handling of such errors.

Other:

I know the code is not very DRY, but my gut feeling tells me it’s too early for abstraction. In the long term, if we have more metrics with similar scenarios where we need to use the HTTP client extensively, we should build a custom HTTP client wrapper centrally and reuse it across all HTTP-based metrics.

@oleg-ssvlabs oleg-ssvlabs merged commit cfe4e88 into main Oct 4, 2024
3 checks passed
@oleg-ssvlabs oleg-ssvlabs deleted the peers-errors-handling branch October 4, 2024 11:12
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