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

*: improve logging and error handling for exits #3347

Merged
merged 15 commits into from
Oct 28, 2024

Conversation

KaloyanTanev
Copy link
Contributor

Add more logging and more detailed errors for exits. Given that the exits are fire and forget operation and not a long running process, we can afford more details without the issue of polluting with too much.

category: feature
ticket: #3136

Copy link

codecov bot commented Oct 23, 2024

Codecov Report

Attention: Patch coverage is 49.12281% with 58 lines in your changes missing coverage. Please review.

Project coverage is 59.65%. Comparing base (0aead1d) to head (746ca39).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
cmd/exit_sign.go 45.16% 17 Missing ⚠️
app/obolapi/api.go 64.70% 9 Missing and 3 partials ⚠️
cmd/exit_broadcast.go 52.00% 12 Missing ⚠️
cmd/exit_fetch.go 20.00% 8 Missing ⚠️
app/obolapi/exit.go 37.50% 4 Missing and 1 partial ⚠️
cmd/exit_list.go 25.00% 3 Missing ⚠️
cmd/cmd.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3347      +/-   ##
==========================================
+ Coverage   58.69%   59.65%   +0.96%     
==========================================
  Files         210      210              
  Lines       30290    30289       -1     
==========================================
+ Hits        17778    18069     +291     
+ Misses      10614    10325     -289     
+ Partials     1898     1895       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if res.StatusCode/100 != 2 {
data, err := io.ReadAll(res.Body)
if err != nil {
return errors.Wrap(err, "read POST response")
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great to catch the status code as well as headers when an error occurs, or maybe log them as debug. Also, verbose logging may be printing the body as base64 or json (depending on content-type). I remember I needed this a few times and patched this code locally to do so.

Copy link
Contributor Author

@KaloyanTanev KaloyanTanev Oct 23, 2024

Choose a reason for hiding this comment

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

It would be great to catch the status code as well as headers when an error occurs, or maybe log them as debug.

Indeed! Added it.

Also, verbose logging may be printing the body as base64 or json (depending on content-type).

What do you mean here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I realized we don't have verbose logging level, debug is the minimum.
I meant the ability to intercept HTTP requests and responses (bodies) when we need to intercept traffic between stack components.. in addition to HTTP status code, URL and Headers. To see the full picture.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see now. Yes having some sort of a "trace" logging would help in a lot of scenarios I believe. We can probably add it on the roadmap to add it throughout the project?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe if your Wireshark experience was successful then we don't need to add anything here. Anyway this out of scope for the current work.

Copy link

sonarcloud bot commented Oct 23, 2024

@KaloyanTanev KaloyanTanev added the merge when ready Indicates bulldozer bot may merge when all checks pass label Oct 28, 2024
@obol-bulldozer obol-bulldozer bot merged commit 45c1ef5 into main Oct 28, 2024
12 checks passed
@obol-bulldozer obol-bulldozer bot deleted the kalo/improve-exits-errors-and-logging branch October 28, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants