Attach span to error reporting span #220
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed when debugging settlement failures that we weren't logging with the
auction
span when reporting errors (i.e. simulating on the original block and generating a Tenderly link with the failed simulation).This is because we offload the simulation and reporting to a separate Tokio-rs task so that we can already start the next auction without delaying for informative error reporting (which is, IMO a very good thing). However, this makes it hard to tie the simulation errors with what auction it belongs to without looking at surrounding logs.
Luckily it is very easy to so -
Span::current()
allows us to instrument a separate task using the span of the currently executing task.Additionally, I promoted the
auction
span to be at theINFO
level. This makes it so filtering logs likesolver=info
still includes the span information (i.e. if we only show info logs, we still want to include theauction{id=...}
with the logs).Test Plan
CI. Also, run locally in
DryRun
mode with an invalid solver so that simulations always fail, and see that we now includeauction{id=...}
span in the log message: