-
Notifications
You must be signed in to change notification settings - Fork 931
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
fix(core): correctly set Listener.handleNewSignedBlockfrom's spanStatus from returned error or panics #3817
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3817 +/- ##
==========================================
+ Coverage 44.83% 46.41% +1.57%
==========================================
Files 265 314 +49
Lines 14620 18151 +3531
==========================================
+ Hits 6555 8424 +1869
- Misses 7313 8709 +1396
- Partials 752 1018 +266 ☔ View full report in Codecov by Sentry. |
There is a lint issue and LGTM |
b44a7da
to
563f827
Compare
Thanks @Wondertan! Kindly help me take a look again. |
563f827
to
40598bc
Compare
…us from returned error or panics This change ensures that if a panic occurs, that span.RecordError correctly records it and then if an error is returned that span.Status correctly captures and records it. Fixes celestiaorg#3814
40598bc
to
fbc937c
Compare
All checks passing, we are good to go @Wondertan |
// Record the "exception"/panic. | ||
span.RecordError(rerr) |
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.
Lets move it out of recover block and put it instead of SetStatus
, while SetStatus
goes to every individual error check.
As per otel API these are used together and not only on recovering. RecordError
does what it says, while SetStatus
has a description on it to put next to the operation.
So extendBlock
would become
eds, err := extendBlock(b.Data, b.Header.Version.App)
if err != nil {
span.SetStatus(codes.Error, "extendBlock")
return fmt.Errorf("extending block data: %w", err)
}
and so on
if r != nil { // Re-panic | ||
panic(r) | ||
} |
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.
Wanted to avoid re-panicing, but actually we should so that the panic during sync doesn't go unnoticed
[not actionable]
@odeke-em would you be able to implement the changes requested by Hlib here or should we take over the PR from you? If we don't hear back in a week, we'll take it over. Thanks! |
Hey @renaynay, please feel free to take over. Thank you. |
This change ensures that if a panic occurs, that span.RecordError correctly records it and then if an error is returned that span.Status correctly captures and records it.
Fixes #3814