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

fatxpool: use tracing instead of log #5490

Closed
Tracked by #5472
michalkucharczyk opened this issue Aug 27, 2024 · 6 comments · Fixed by #6897
Closed
Tracked by #5472

fatxpool: use tracing instead of log #5490

michalkucharczyk opened this issue Aug 27, 2024 · 6 comments · Fixed by #6897
Assignees
Labels
T0-node This PR/Issue is related to the topic “node”.

Comments

@michalkucharczyk
Copy link
Contributor

Generally it would be better to use the tracing log macros.
Originally posted by @bkchr in #4639 (comment)

@michalkucharczyk
Copy link
Contributor Author

also:
#6405 (comment)

@dharjeezy
Copy link
Contributor

can i get to work on this? @michalkucharczyk

@michalkucharczyk
Copy link
Contributor Author

Yes.

@michalkucharczyk
Copy link
Contributor Author

michalkucharczyk commented Dec 5, 2024

@dharjeezy

A comment on how I see this. In general all log::[debug|trace|info] macros shall be replaced with their tracing counterpart.

Please do not change levels, and text messages. If the message contains already contains some "value: {}" or "value= {}", it should be migrated to the field. Example:

log::debug!(target: LOG_TARGET,
"fatp::ready_at_light {} from {} before: {} to be removed: {} after: {} took:{:?}",
at,
best_view.at.hash,
before_count,
all_extrinsics.len(),
after_count,
start.elapsed()
);

could be written more or less as the following:

tracing::debug!(target: LOG_TARGET,
	"fatp::ready_at_light",
	at,
	from = best_view.at.hash,
	before = before_count,
	to_be_removed = all_extrinsics.len(),
	after,
	took = start.elapsed()
);

You could start with a single file, and ping me when you think it is done. We will discuss if it is OK, or if any improvements are needed. Does it sound ok for you?

@michalkucharczyk
Copy link
Contributor Author

One more thought.

On the trace level the logs for individual transactions are printed. They start with [0xHASH] prefix. Examples:

log::trace!(target: LOG_TARGET, "[{:?}] fatp::dropped notification {:?}, removing", dropped_tx_hash,dropped.reason);

log::trace!(target: LOG_TARGET, "[{:?}] fatp::submit_one views:{}", self.tx_hash(&xt), self.active_views_count());

and there is also macro that prints the iterator over transactions:
log_xt_trace!(target: LOG_TARGET, xts.iter().map(|xt| self.tx_hash(xt)), "[{:?}] fatp::submit_at");

I think we should get rid of the prefix in this case use the hash as regular field, e.g. txhash. It shall be the same name for every debug event.

@dharjeezy
Copy link
Contributor

dharjeezy commented Dec 7, 2024

Ok. Thank you for the clarifications.

@michalkucharczyk michalkucharczyk moved this from Todo to In Progress in fork-aware-txpool Jan 7, 2025
github-merge-queue bot pushed a commit that referenced this issue Jan 30, 2025
This PR modifies the fatxpool to use tracing instead of log for logging.

closes #5490

Polkadot address: 12GyGD3QhT4i2JJpNzvMf96sxxBLWymz4RdGCxRH5Rj5agKW

---------

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this from In Progress to Done in fork-aware-txpool Jan 30, 2025
Ank4n pushed a commit that referenced this issue Feb 6, 2025
This PR modifies the fatxpool to use tracing instead of log for logging.

closes #5490

Polkadot address: 12GyGD3QhT4i2JJpNzvMf96sxxBLWymz4RdGCxRH5Rj5agKW

---------

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T0-node This PR/Issue is related to the topic “node”.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants