-
Notifications
You must be signed in to change notification settings - Fork 618
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
[tracing] Add tracing for Garbage Collection #10177
[tracing] Add tracing for Garbage Collection #10177
Conversation
chain/chain/src/store.rs
Outdated
@@ -2344,6 +2344,7 @@ impl<'a> ChainStoreUpdate<'a> { | |||
// Now we can proceed to removing the trie state and flat state | |||
let mut store_update = self.store().store_update(); | |||
for shard_uid in prev_shard_layout.get_shard_uids() { | |||
tracing::info!("GC resharding, block_hash {}, shard_uid {}", block_hash, shard_uid); |
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.
Please check out the style guidelines, on tracing use at https://github.com/near/nearcore/blob/master/docs/practices/style.md#Tracing.
tracing::info!("GC resharding, block_hash {}, shard_uid {}", block_hash, shard_uid); | |
tracing::info!(target: "...", block_hash, shard_uid, "GC resharding"); |
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.
Apologies
@@ -996,7 +996,7 @@ impl Chain { | |||
tries: ShardTries, | |||
gc_config: &near_chain_configs::GCConfig, | |||
) -> Result<(), Error> { | |||
let _span = tracing::debug_span!(target: "chain", "clear_data").entered(); | |||
let _span = tracing::debug_span!(target: "garbage_collection", "clear_data").entered(); |
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.
Changing the target here seems a bit controversial, what is your goal here?
Personally I would rather keep it as chain but add the GC prefix as you've done elsewhere. Not a blocker, more of a preference and I don't think we have any guidelines on this so feel free to keep as is.
GCMode::Fork(_) => write!(f, "GCMode::Fork"), | ||
GCMode::Canonical(_) => write!(f, "GCMode::Canonical"), | ||
GCMode::StateSync { .. } => write!(f, "GCMode::StateSync"), |
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.
nit: You can use the f.debug_struct method. Under the hood it'll also use write but you're guaranteed that its style will be consistent with the rest of the codebase and the defaults. You can find plenty of examples in the codebase.
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.
Just checked, I think write!
is fine here as we don't have any other fields we would like to print out here.
Adding logs for generic GC.
Tracing for GC during the last block of the epoch during which resharding happened.