-
Notifications
You must be signed in to change notification settings - Fork 140
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
[v2] Add a Log execution event, created with the log syscall #1396
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## release/v2 #1396 +/- ##
==============================================
- Coverage 51.18% 50.25% -0.93%
==============================================
Files 126 126
Lines 10267 10458 +191
==============================================
+ Hits 5255 5256 +1
- Misses 5012 5202 +190
|
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.
Nits but LGTM.
fvm/src/call_manager/mod.rs
Outdated
@@ -121,6 +121,12 @@ pub trait CallManager: 'static { | |||
self.gas_tracker_mut().apply_charge(charge)?; | |||
Ok(()) | |||
} | |||
|
|||
/// Whether tracing is requested. | |||
fn tracing(&self) -> bool; |
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.
Any reason not to just call call_manager.machine().context().tracing
? It's long, but we only call this once.
Otherwise, I'd provide a default implementation that delegates to self.machine().context().tracing
.
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.
Added the default implementation, thanks. There are additionally 3 internal calls to this, and the many hops to get there adds coupling through those objects at more places.
I am attempting to improve instrumentation to support analysis of gas charges across spans of code. See #1397.
This PR adds a
Log
execution event to the trace format. A log event is recorded when thelog
syscall is invoked. The log event carries a singleString
message.A string is the most basic payload to carry here, so I think the right place to start. Some structure may be encoded into strings (for subsequent offline analysis). We could consider adding some kind of key/value pair metadata, but I suggest we defer until observed usage justifies it.
Note that the GasCharge event's
name
is aCow<'static, str>
. I presume this is because the same literal name is expected to be used frequently and this type will lead to meaningful optimisation. I'm not sure that that's appropriate for theLog
event, if it would rule out dynamically constructed messages.This PR is against the
release/v2
branch, because I am analysing the built-in actors that are not yet using fvm v3. I intend to forward-port it when stable.