Skip to content

Commit a284f2a

Browse files
committed
fix(tracing): demote spans to trace level + add slot field to slot processing logs
1 parent 6013b40 commit a284f2a

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

src/main.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ async fn main() -> Result<()> {
5757
num_chunks
5858
};
5959

60-
info!(
61-
"Processing slots from {} to {}, partitioned into {} chunks…",
62-
current_slot, latest_slot, num_chunks
63-
);
64-
6560
for i in 0..num_chunks {
6661
let slots_in_current_chunk = if i == num_chunks - 1 {
6762
current_max_slots_size + remaining_slots
@@ -92,22 +87,21 @@ async fn main() -> Result<()> {
9287
},
9388
|e, duration: Duration| {
9489
let duration = duration.as_secs();
95-
warn!("Failed to update latest slot to {}. Retrying in {duration} seconds… (Reason: {e})", chunk_final_slot - 1);
90+
warn!(latest_slot = chunk_final_slot - 1, "Failed to update latest slot. Retrying in {duration} seconds… (Reason: {e})");
9691
},
9792
).await {
9893
Ok(_) => (),
9994
Err(err) => {
100-
error!("Failed to update latest slot to {}", chunk_final_slot - 1);
95+
error!(latest_slot = chunk_final_slot - 1, "Failed to update latest slot");
10196
return Err(err.into());
10297
}
10398
};
10499

105100
info!(
106-
"Chunk {} of {} ({} slots) processed successfully!. Latest slot updated to {}.",
107-
i+1,
101+
"Chunk {} of {}: {} slots processed successfully!.",
102+
i + 1,
108103
num_chunks,
109104
chunk_final_slot - chunk_initial_slot,
110-
chunk_final_slot - 1
111105
);
112106
}
113107

src/slots_processor/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl SlotsProcessor {
6868
let thread_initial_slot = start_slot + i * slots_per_thread;
6969
let thread_final_slot = thread_initial_slot + slots_in_current_thread;
7070

71-
let thread_slots_span = tracing::debug_span!(
71+
let thread_slots_span = tracing::trace_span!(
7272
"slots_chunk_processor",
7373
chunk_initial_slot = thread_initial_slot,
7474
chunk_final_slot = thread_final_slot
@@ -79,15 +79,15 @@ impl SlotsProcessor {
7979
let slot_processor = SlotProcessor::new(thread_context);
8080

8181
for current_slot in thread_initial_slot..thread_final_slot {
82-
let slot_span = tracing::info_span!("slot_processor", slot = current_slot);
82+
let slot_span = tracing::trace_span!("slot_processor");
8383

8484
let result = slot_processor
8585
.process_slot(current_slot)
8686
.instrument(slot_span)
8787
.await;
8888

8989
if let Err(error) = result {
90-
error!("Failed to process slot {current_slot}: {error}");
90+
error!(current_slot, "Failed to process slot: {error}");
9191

9292
return Err(SlotsChunkThreadError::FailedChunkProcessing {
9393
initial_slot: thread_initial_slot,

src/slots_processor/slot_processor/mod.rs

+17-8
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ impl SlotProcessor {
3535
|| async move { self._process_slot(slot).await },
3636
|e, duration: Duration| {
3737
let duration = duration.as_secs();
38-
warn!("Failed to process slot. Retrying in {duration} seconds… (Reason: {e})");
38+
warn!(
39+
slot,
40+
"Failed to process slot. Retrying in {duration} seconds… (Reason: {e})"
41+
);
3942
},
4043
)
4144
.await
@@ -55,7 +58,7 @@ impl SlotProcessor {
5558
{
5659
Some(block) => block,
5760
None => {
58-
info!("Skipping as there is no beacon block");
61+
info!(slot, "Skipping as there is no beacon block");
5962

6063
return Ok(());
6164
}
@@ -64,7 +67,10 @@ impl SlotProcessor {
6467
let execution_payload = match beacon_block.body.execution_payload {
6568
Some(payload) => payload,
6669
None => {
67-
info!("Skipping as beacon block doesn't contain execution payload");
70+
info!(
71+
slot,
72+
"Skipping as beacon block doesn't contain execution payload"
73+
);
6874

6975
return Ok(());
7076
}
@@ -73,7 +79,10 @@ impl SlotProcessor {
7379
match beacon_block.body.blob_kzg_commitments {
7480
Some(commitments) => commitments,
7581
None => {
76-
info!("Skipping as beacon block doesn't contain blob kzg commitments");
82+
info!(
83+
slot,
84+
"Skipping as beacon block doesn't contain blob kzg commitments"
85+
);
7786

7887
return Ok(());
7988
}
@@ -94,7 +103,7 @@ impl SlotProcessor {
94103
.map_err(|err| BackoffError::permanent(SlotProcessorError::Other(err)))?;
95104

96105
if tx_hash_to_versioned_hashes.is_empty() {
97-
info!("Skipping as execution block doesn't contain blob txs");
106+
info!(slot, "Skipping as execution block doesn't contain blob txs");
98107

99108
return Ok(());
100109
}
@@ -108,15 +117,15 @@ impl SlotProcessor {
108117
{
109118
Some(blobs) => {
110119
if blobs.is_empty() {
111-
info!("Skipping as blobs sidecar is empty");
120+
info!(slot, "Skipping as blobs sidecar is empty");
112121

113122
return Ok(());
114123
} else {
115124
blobs
116125
}
117126
}
118127
None => {
119-
info!("Skipping as there is no blobs sidecar");
128+
info!(slot, "Skipping as there is no blobs sidecar");
120129

121130
return Ok(());
122131
}
@@ -152,7 +161,7 @@ impl SlotProcessor {
152161
.await
153162
.map_err(SlotProcessorError::BlobscanClient)?;
154163

155-
info!("Block, txs and blobs indexed successfully");
164+
info!(slot, "Block, txs and blobs indexed successfully");
156165

157166
Ok(())
158167
}

0 commit comments

Comments
 (0)