Automatically pass spans into blocking handles (#8158)

Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
Eitan Seri-Levi
2026-04-01 11:13:20 +09:00
committed by GitHub
parent 03385d698d
commit 99f5a92b98
9 changed files with 29 additions and 82 deletions

View File

@@ -4,7 +4,7 @@ use educe::Educe;
use eth2::types::{EventKind, SseExecutionPayloadGossip};
use parking_lot::{Mutex, RwLock};
use store::DatabaseBlock;
use tracing::{Span, debug};
use tracing::debug;
use types::{
ChainSpec, EthSpec, ExecutionPayloadBid, ExecutionPayloadEnvelope, Hash256, SignedBeaconBlock,
SignedExecutionPayloadEnvelope, Slot, consts::gloas::BUILDER_INDEX_SELF_BUILD,
@@ -270,12 +270,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
envelope: Arc<SignedExecutionPayloadEnvelope<T::EthSpec>>,
) -> Result<GossipVerifiedEnvelope<T>, EnvelopeError> {
let chain = self.clone();
let span = Span::current();
self.task_executor
.clone()
.spawn_blocking_handle(
move || {
let _guard = span.enter();
let slot = envelope.slot();
let beacon_block_root = envelope.message.beacon_block_root;

View File

@@ -192,13 +192,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
} = import_data;
let block_root = {
// Capture the current span before moving into the blocking task
let current_span = tracing::Span::current();
let chain = self.clone();
self.spawn_blocking_handle(
move || {
// Enter the captured span in the blocking thread
let _guard = current_span.enter();
chain.import_execution_payload_envelope(
envelope,
block_root,