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

feat: add more logs to autonomi and evmlib #2447

Closed
wants to merge 3 commits into from

Conversation

ermineJose
Copy link
Contributor

@ermineJose ermineJose commented Nov 15, 2024

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.

  • Bug fix (non-breaking change which fixes an issue)
  • [ x] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Checklist

Please ensure all of the following tasks have been completed:

  • I have read the contributing guidelines.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have updated the documentation accordingly.
  • I have followed the conventional commits guidelines for commit messages.
  • I have verified my commit messages with commitlint.

@ermineJose ermineJose force-pushed the feat_add-more-logs-autonomi-evmlib branch from 30f7431 to a4214aa Compare November 19, 2024 11:07
@ermineJose ermineJose marked this pull request as ready for review November 19, 2024 11:09
@ermineJose ermineJose force-pushed the feat_add-more-logs-autonomi-evmlib branch 2 times, most recently from b428a2c to d072959 Compare November 19, 2024 11:53
@ermineJose ermineJose changed the title feat: add more logs to autonomi feat: add more logs to autonomi and evmlib Nov 19, 2024
@ermineJose ermineJose requested review from grumbach and b-zee November 20, 2024 07:53
@ermineJose ermineJose force-pushed the feat_add-more-logs-autonomi-evmlib branch 2 times, most recently from 9e41b73 to dcf8786 Compare November 25, 2024 11:56
@ermineJose ermineJose force-pushed the feat_add-more-logs-autonomi-evmlib branch from dcf8786 to 177faa1 Compare November 25, 2024 12:09
@ermineJose ermineJose force-pushed the feat_add-more-logs-autonomi-evmlib branch from 177faa1 to 3726299 Compare November 25, 2024 17:23
@@ -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");
Copy link
Member

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?

Suggested change
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");
Copy link
Member

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");
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

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");
Copy link
Member

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.

@ermineJose ermineJose closed this Dec 3, 2024
@ermineJose ermineJose deleted the feat_add-more-logs-autonomi-evmlib branch December 19, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants