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

add log for txpool tx track #1046

Closed
wants to merge 13 commits into from
Closed

Conversation

georgehao
Copy link
Member

@georgehao georgehao commented Sep 18, 2024

1. Purpose or design rationale of this PR

add log for tx that be consumed in txpool

2. PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • build: Changes that affect the build system or external dependencies (example scopes: yarn, eslint, typescript)
  • ci: Changes to our CI configuration files and scripts (example scopes: vercel, github, cypress)
  • docs: Documentation-only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that doesn't fix a bug, or add a feature, or improves performance
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests

3. Deployment tag versioning

Has the version in params/version.go been updated?

  • This PR doesn't involve a new deployment, git tag, docker image tag, and it doesn't affect traces
  • Yes

4. Breaking change label

Does this PR have the breaking-change label?

  • This PR is not a breaking change
  • Yes

Summary by CodeRabbit

  • New Features

    • Enhanced logging for transaction eviction and lifecycle management, improving monitoring capabilities.
  • Chores

    • Updated version patch from 24 to 25, reflecting the latest release version.

colinlyguo
colinlyguo previously approved these changes Sep 18, 2024
core/tx_pool.go Outdated Show resolved Hide resolved
core/tx_pool.go Outdated Show resolved Hide resolved
core/tx_pool.go Outdated Show resolved Hide resolved
core/tx_pool.go Outdated Show resolved Hide resolved
jonastheis
jonastheis previously approved these changes Sep 23, 2024
Copy link

coderabbitai bot commented Oct 21, 2024

Walkthrough

The changes in this pull request focus on enhancing logging within the TxPool implementation in core/tx_pool.go and updating the patch version in params/version.go. The logging improvements include the addition of log statements for transaction eviction and long-lived transactions. Additionally, the VersionPatch constant has been incremented from 24 to 25, reflecting a minor version update without altering any core functionality.

Changes

File Change Summary
core/tx_pool.go Enhanced logging for transaction eviction and long-lived transactions; added debug logs.
params/version.go Updated VersionPatch constant from 24 to 25 to reflect a patch version increment.

Poem

In the burrow deep, where the logs do leap,
A patch was made, not a sound to keep.
With info bright, the transactions shine,
Evictions noted, all is fine!
Hopping through code, we cheer with glee,
For every change, a better spree! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0fe76c1 and f1edc6a.

📒 Files selected for processing (1)
  • core/tx_pool.go (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/tx_pool.go

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (8)
core/tx_pool.go (8)

434-436: Consider using Debug log level for transaction evictions

While logging evicted transactions is useful for debugging, using the Info log level for frequent operations like transaction evictions might lead to excessive logging. Consider changing this to log.Debug to reduce log verbosity during normal operations.

-						log.Info("evict queue tx for timeout", "tx", tx.Hash().String())
+						log.Debug("evict queue tx for timeout", "tx", tx.Hash().String())

869-870: Consider using Debug log level for new pooled transactions

Similar to the previous comment, logging new pooled transactions at the Info level might lead to excessive logging during normal operations. Consider changing this to log.Debug to maintain consistency and reduce log verbosity.

-		log.Info("Pooled new executable transaction", "hash", hash, "from", from, "to", tx.To())
+		log.Debug("Pooled new executable transaction", "hash", hash, "from", from, "to", tx.To())

891-892: Consider using Debug log level for new future transactions

Consistent with the previous comments, logging new future transactions at the Info level might lead to excessive logging during normal operations. Consider changing this to log.Debug to maintain consistency across the codebase and reduce log verbosity.

-	log.Info("Pooled new future transaction", "hash", hash, "from", from, "to", tx.To())
+	log.Debug("Pooled new future transaction", "hash", hash, "from", from, "to", tx.To())

Line range hint 926-932: Consider using Debug log level for enqueued transactions and good addition of "new tx" info

Consistent with the previous comments, logging enqueued transactions at the Info level might lead to excessive logging during normal operations. Consider changing this to log.Debug to maintain consistency across the codebase and reduce log verbosity.

The addition of the "new tx" information in the log is a good improvement, as it helps distinguish between new and existing transactions.

-	log.Info("Enqueued transaction", "hash", hash.String(), "from", from, "to", tx.To(), "new tx", !addAll)
+	log.Debug("Enqueued transaction", "hash", hash.String(), "from", from, "to", tx.To(), "new tx", !addAll)

980-981: Consider using Debug log level for promoted transactions

In line with the previous comments, logging promoted transactions at the Info level might lead to excessive logging during normal operations. Consider changing this to log.Debug to maintain consistency across the codebase and reduce log verbosity.

-	log.Info("Promoted transaction from queue to pending", "hash", hash.String(), "from", addr, "to", tx.To())
+	log.Debug("Promoted transaction from queue to pending", "hash", hash.String(), "from", addr, "to", tx.To())

1152-1154: Consider using Debug log level for removed transactions

Consistent with the previous comments, logging removed transactions at the Info level might lead to excessive logging during normal operations. Consider changing this to log.Debug to maintain consistency across the codebase and reduce log verbosity.

-	log.Info("remove tx", "hash", hash, "outofbound", outofbound)
+	log.Debug("remove tx", "hash", hash, "outofbound", outofbound)

1381-1383: Consider using Debug log level for consistency, but Info might be acceptable

While we've been recommending changing log levels to Debug for consistency and to reduce log verbosity, this particular log for dumping transaction hashes during reorg might be acceptable at the Info level. It's a less frequent operation and is guarded by a threshold check.

However, for the sake of consistency across the codebase, you might still want to consider changing it to Debug. The decision should be based on how critical this information is for regular monitoring vs. debugging.

If you decide to change it for consistency:

-				log.Info("dumping runReorg tx hashes", "txHash", txs.Hash().Hex())
+				log.Debug("dumping runReorg tx hashes", "txHash", txs.Hash().Hex())

1535-1537: Consider using Debug log level for removed cap-exceeding transactions

Consistent with the previous comments, logging removed cap-exceeding transactions at the Info level might lead to excessive logging, especially if the cap is frequently reached. Consider changing this to log.Debug to maintain consistency across the codebase and reduce log verbosity.

-						log.Info("Removed cap-exceeding queued transaction", "hash", hash)
+						log.Debug("Removed cap-exceeding queued transaction", "hash", hash)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c88cc48 and 0fe76c1.

📒 Files selected for processing (2)
  • core/tx_pool.go (9 hunks)
  • params/version.go (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
core/tx_pool.go (1)

1776-1778: Appropriate use of Warn log level for long-lived transactions

This is a good addition to the logging system. Using the Warn log level for transactions that have been in the pool for over 30 minutes is appropriate. It helps highlight potential issues with long-lived transactions without being as verbose as Info-level logging.

The condition txLifecycle >= time.Minute*30 ensures that this log only appears for truly long-lived transactions, which is a good practice to avoid unnecessary warnings.

params/version.go Show resolved Hide resolved
@georgehao
Copy link
Member Author

georgehao commented Oct 21, 2024

rollback some log level. use vmodule=core/tx_pool.go=4 to instead. https://github.com/scroll-tech/testnet/pull/1423/files

colinlyguo
colinlyguo previously approved these changes Oct 21, 2024
0xmountaintop
0xmountaintop previously approved these changes Oct 21, 2024
@georgehao georgehao changed the base branch from develop to syncUpstream/active October 21, 2024 14:27
@georgehao georgehao dismissed stale reviews from 0xmountaintop and colinlyguo October 21, 2024 14:27

The base branch was changed.

@georgehao georgehao changed the base branch from syncUpstream/active to develop October 21, 2024 14:31
@georgehao
Copy link
Member Author

Close this pr to update the changes to syncUpstream/active branch. #1079

@georgehao georgehao closed this Oct 21, 2024
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.

5 participants