-
Notifications
You must be signed in to change notification settings - Fork 54
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
feat: add more logs to autonomi and evmlib #2447
Conversation
30f7431
to
a4214aa
Compare
b428a2c
to
d072959
Compare
9e41b73
to
dcf8786
Compare
dcf8786
to
177faa1
Compare
177faa1
to
3726299
Compare
@@ -93,13 +93,15 @@ impl Archive { | |||
.as_secs(); | |||
meta.modified = now; | |||
self.map.insert(new_path.to_path_buf(), (data_addr, meta)); | |||
debug!("File renamed successfully in the archive"); |
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.
Could we add context here, i.e., add in the vars old_path
and new_path
?
debug!("File renamed successfully in the archive"); | |
debug!("File renamed successfully in the archive, old path: {old_path:?} new path: {new_path:?}"); |
Ok(()) | ||
} | ||
|
||
/// Add a file to a local archive | ||
/// Note that this does not upload the archive to the network | ||
pub fn add_file(&mut self, path: PathBuf, data_addr: DataAddr, meta: Metadata) { | ||
self.map.insert(path, (data_addr, meta)); | ||
debug!("Added file successfully to the archive"); |
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.
Could we add more context here?
@@ -176,6 +176,7 @@ impl Client { | |||
.await | |||
.inspect_err(|err| error!("Error uploading chunk {address:?} :{err:?}")) | |||
}); | |||
debug!("Finished preparing upload tasks"); |
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.
This would not be useful as we're just pushing tasks to a vec.
@@ -218,26 +220,33 @@ impl Client { | |||
info!("Getting chunk: {addr:?}"); | |||
|
|||
let key = NetworkAddress::from_chunk_address(ChunkAddress::new(addr)).to_record_key(); | |||
|
|||
debug!("Converted chunk address to network record key: {:?}", key); |
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.
This is trivial and cannot fail too. It is not required to tell that we've obtained the key. Instead the key
can be used in other places to track a particular data on the network. For eg., debug!("Record fetched from network: {:?}", key);
let get_cfg = GetRecordCfg { | ||
get_quorum: Quorum::One, | ||
retry_strategy: None, | ||
target_record: None, | ||
expected_holders: HashSet::new(), | ||
is_register: false, | ||
}; | ||
debug!("GetRecordCfg created: {:?}", get_cfg); |
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.
Trivial and can be removed.
|
||
let record = self | ||
.network | ||
.get_record_from_network(key, &get_cfg) | ||
.await | ||
.inspect_err(|err| error!("Error fetching chunk: {err:?}"))?; | ||
debug!("Record fetched from network: {:?}", record); |
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.
We should not log record
as it will be pure Bytes and unreadable. You should probably log the key
or address
here
let header = RecordHeader::from_record(&record)?; | ||
|
||
debug!("Record header created: {:?}", header); |
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.
Trivial and can be removed.
@@ -98,7 +98,7 @@ impl Client { | |||
let local = !peers.iter().any(multiaddr_is_global); | |||
|
|||
let (network, event_receiver) = build_client_and_run_swarm(local); | |||
|
|||
debug!("Client is built and swarm driver initiated"); |
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.
Trivial and can be removed.
Description
Adds more tracebility to autonomi and evmlib. Assists in adding more logs for better debugging.
Related Issue
Fixes #<issue_number> (if applicable).
Type of Change
Please mark the types of changes made in this pull request.
Checklist
Please ensure all of the following tasks have been completed: