Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
c1a50bb
Add opentelemetry OTLP exporter for spans.
jimmygchen Jul 30, 2025
6dba431
Add `workspace_filter` to telemetry layer to exclude libp2p traces.
jimmygchen Jul 30, 2025
4147599
Squashed commit of the following:
jimmygchen Jul 30, 2025
04c23d9
Remove all spans.
jimmygchen Jul 30, 2025
03c647a
load_parent test.
jimmygchen Jul 30, 2025
c0804dc
Add gossip block instrumentation.
jimmygchen Jul 30, 2025
0a8d22f
more instrument.
jimmygchen Jul 30, 2025
172d859
Instrument `process_block` and `import_block`.
jimmygchen Jul 30, 2025
386b425
Add more detailed instruments to `import_block`
jimmygchen Jul 30, 2025
4268ae5
Add more detailed instruments to `import_block`
jimmygchen Jul 30, 2025
3f55de0
Add more detailed instruments to `import_block`
jimmygchen Jul 30, 2025
26e30c3
More instruments.
jimmygchen Jul 30, 2025
db4d342
More instruments.
jimmygchen Jul 30, 2025
62940aa
More instruments.
jimmygchen Jul 30, 2025
e3f6273
Add service name
jimmygchen Jul 30, 2025
2f6c32b
More instruments
jimmygchen Jul 30, 2025
e7fcb4c
Attempt to fix orphan spans
jimmygchen Jul 30, 2025
868320a
A few more
jimmygchen Jul 31, 2025
a8055ae
disable resource to test root span not yet received issue
jimmygchen Jul 31, 2025
e4e9746
Clean ups.
jimmygchen Jul 31, 2025
533ecc0
Revert potential bad change from 62940aa1 (resulted in missing root s…
jimmygchen Jul 31, 2025
29d65bc
Add instrument back in.
jimmygchen Jul 31, 2025
033861b
Merge branch 'tracing-spans-test' of github.com:jimmygchen/lighthouse…
jimmygchen Jul 31, 2025
3ac075f
Make `process_block` a root span.
jimmygchen Jul 31, 2025
fb3bf31
More fixes
jimmygchen Jul 31, 2025
333773f
More fixes
jimmygchen Jul 31, 2025
e1f584e
Fix span levels and add tracing to gossip/rpc block and blob paths.
jimmygchen Jul 31, 2025
c0991f5
Add process chain segment
jimmygchen Jul 31, 2025
d340231
Set parent to None on network beacon processors to prevent inheriting…
jimmygchen Jul 31, 2025
91a2400
Add RPC method instruments.
jimmygchen Jul 31, 2025
4a3689d
Remove unnecessary enter()
jimmygchen Aug 1, 2025
d1751f1
Fill more instrument gaps in `process_chain_segment`
jimmygchen Aug 1, 2025
61a772f
Fill more instrument gaps in `process_chain_segment`
jimmygchen Aug 1, 2025
b358a1a
Instrument `PendingComponents`.
jimmygchen Aug 1, 2025
4af2855
Instrument `PendingComponents` set parent to `None` to avoid incorrec…
jimmygchen Aug 1, 2025
1cd9683
Remove unnecessary `allow` macro usage
jimmygchen Aug 6, 2025
ec37ad9
Merge branch 'unstable' into tracing-spans-test
jimmygchen Aug 6, 2025
a5ce826
Instrument rpc methods and by root responses. (TODO: by range responses)
jimmygchen Aug 6, 2025
4dddfc1
Fix lint
jimmygchen Aug 6, 2025
e491c85
Add missing field declarations.
jimmygchen Aug 6, 2025
cf3a216
Improve RPC spans.
jimmygchen Aug 6, 2025
4c7ef8b
Close a span properly and remove unnecessary span.
jimmygchen Aug 6, 2025
68c8345
Track individual range requests.
jimmygchen Aug 6, 2025
e922250
Rename `outgoing_custody_request` and instrument all rpc methods with…
jimmygchen Aug 6, 2025
40b84f3
Fix spans not entering correctly.
jimmygchen Aug 6, 2025
57a8d56
More missing enters..
jimmygchen Aug 6, 2025
addf716
Refactor rabithole to clean things up and only allow for pre-defined …
jimmygchen Aug 7, 2025
226b635
Display client kind instead
jimmygchen Aug 7, 2025
e2605e3
Record client kind properly
jimmygchen Aug 7, 2025
1d6ee71
Record client kind properly
jimmygchen Aug 7, 2025
474d100
Merge remote-tracking branch 'origin/unstable' into tracing-spans-rpc
jimmygchen Aug 8, 2025
5acfd53
Merge remote-tracking branch 'origin/unstable' into tracing-spans-rpc
jimmygchen Aug 13, 2025
7762c16
Skip exporting spans that are not part of / descendants of the allowe…
jimmygchen Aug 13, 2025
433010d
Revert Makefile changes and re-arrange imports
jimmygchen Aug 13, 2025
9132c9e
Add missing instrument on backfill
jimmygchen Aug 13, 2025
3e020b9
Add some notes about panic
jimmygchen Aug 13, 2025
ac75779
Remove root span filtering layer, couldn't get it to work.
jimmygchen Aug 13, 2025
921fa75
Instrumnet `SyncingChain`
jimmygchen Aug 14, 2025
9ae161a
Instrument `SyncingChain`
jimmygchen Aug 14, 2025
fa3051a
Merge branch 'tracing-spans-rpc' of github.com:jimmygchen/lighthouse …
jimmygchen Aug 14, 2025
ee50628
Replace syncing chain child spans with events
jimmygchen Aug 14, 2025
5f18692
Add more context to traces
jimmygchen Aug 15, 2025
4b90aef
Fix docs
jimmygchen Aug 15, 2025
61d8913
Consistent span level
jimmygchen Aug 15, 2025
573cbf3
Remove span fields that are not useful
jimmygchen Aug 15, 2025
5467596
Remove unused deps
jimmygchen Aug 15, 2025
5aa0b82
Merge remote-tracking branch 'origin/unstable' into tracing-spans-rpc
jimmygchen Aug 19, 2025
5ed1c6d
Code clean up and remove unnecessary span fields.
jimmygchen Aug 19, 2025
6cb4ed5
Merge remote-tracking branch 'origin/unstable' into tracing-spans-rpc
jimmygchen Aug 20, 2025
1dd9188
Merge remote-tracking branch 'origin/unstable' into tracing-spans-rpc
jimmygchen Aug 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ async fn process_block(&self, block: Block) -> Result<(), Error> {
## Build and Development Notes
- Full builds and tests take 5+ minutes - use large timeouts (300s+) for any `cargo build`, `cargo test`, or `make` commands
- Use `cargo check` for faster iteration during development and always run after code changes
- Use `cargo fmt --all && make lint-fix` to format code and fix linting issues once a task is complete
- Prefer targeted package tests (`cargo test -p <package>`) and individual tests over full test suite when debugging specific issues
- Always understand the broader codebase patterns before making changes
- Minimum Supported Rust Version (MSRV) is documented in `lighthouse/Cargo.toml` - ensure Rust version meets or exceeds this requirement
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"beacon_node/http_api",
"beacon_node/http_metrics",
"beacon_node/lighthouse_network",
"beacon_node/lighthouse_tracing",
"beacon_node/network",
"beacon_node/operation_pool",
"beacon_node/store",
Expand Down Expand Up @@ -173,6 +174,7 @@ itertools = "0.10"
kzg = { path = "crypto/kzg" }
libsecp256k1 = "0.7"
lighthouse_network = { path = "beacon_node/lighthouse_network" }
lighthouse_tracing = { path = "beacon_node/lighthouse_tracing" }
lighthouse_validator_store = { path = "validator_client/lighthouse_validator_store" }
lighthouse_version = { path = "common/lighthouse_version" }
lockfile = { path = "common/lockfile" }
Expand Down
1 change: 1 addition & 0 deletions beacon_node/beacon_chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ hex = { workspace = true }
int_to_bytes = { workspace = true }
itertools = { workspace = true }
kzg = { workspace = true }
lighthouse_tracing = { workspace = true }
lighthouse_version = { workspace = true }
logging = { workspace = true }
lru = { workspace = true }
Expand Down
33 changes: 13 additions & 20 deletions beacon_node/beacon_chain/src/block_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ impl<T: BeaconChainTypes> GossipVerifiedBlock<T> {
/// on the p2p network.
///
/// Returns an error if the block is invalid, or if the block was unable to be verified.
#[instrument(name = "verify_gossip_block", skip_all)]
#[instrument(name = "verify_gossip_block", skip_all, fields(block_root = tracing::field::Empty))]
pub fn new(
block: Arc<SignedBeaconBlock<T::EthSpec>>,
chain: &BeaconChain<T>,
Expand Down Expand Up @@ -1227,27 +1227,20 @@ impl<T: BeaconChainTypes> SignatureVerifiedBlock<T> {
signature_verifier
.include_all_signatures_except_proposal(block.as_ref(), &mut consensus_context)?;

let sig_verify_span = info_span!("signature_verify", result = "started").entered();
let result = signature_verifier.verify();
let result = info_span!("signature_verify").in_scope(|| signature_verifier.verify());
match result {
Ok(_) => {
sig_verify_span.record("result", "ok");
Ok(Self {
block: MaybeAvailableBlock::AvailabilityPending {
block_root: from.block_root,
block,
},
Ok(_) => Ok(Self {
block: MaybeAvailableBlock::AvailabilityPending {
block_root: from.block_root,
parent: Some(parent),
consensus_context,
})
}
Err(_) => {
sig_verify_span.record("result", "fail");
Err(BlockError::InvalidSignature(
InvalidSignature::BlockBodySignatures,
))
}
block,
},
block_root: from.block_root,
parent: Some(parent),
consensus_context,
}),
Err(_) => Err(BlockError::InvalidSignature(
InvalidSignature::BlockBodySignatures,
)),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::block_verification_types::{
};
use crate::data_availability_checker::{Availability, AvailabilityCheckError};
use crate::data_column_verification::KzgVerifiedCustodyDataColumn;
use lighthouse_tracing::SPAN_PENDING_COMPONENTS;
use lru::LruCache;
use parking_lot::RwLock;
use std::cmp::Ordering;
Expand Down Expand Up @@ -288,7 +289,7 @@ impl<E: EthSpec> PendingComponents<E> {

/// Returns an empty `PendingComponents` object with the given block root.
pub fn empty(block_root: Hash256, max_len: usize) -> Self {
let span = debug_span!(parent: None, "pending_components", %block_root);
let span = debug_span!(parent: None, SPAN_PENDING_COMPONENTS, %block_root);
let _guard = span.clone().entered();
Self {
block_root,
Expand Down
4 changes: 4 additions & 0 deletions beacon_node/lighthouse_tracing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
name = "lighthouse_tracing"
version = "0.1.0"
edition = { workspace = true }
61 changes: 61 additions & 0 deletions beacon_node/lighthouse_tracing/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//! This module contains root span identifiers for key code paths in the beacon node.
//!
//! TODO: These span identifiers will be used to implement selective tracing export (to be implemented),
//! where only the listed root spans and their descendants will be exported to the tracing backend.

/// Data Availability checker span identifiers
pub const SPAN_PENDING_COMPONENTS: &str = "pending_components";

/// Gossip methods root spans
pub const SPAN_PROCESS_GOSSIP_DATA_COLUMN: &str = "process_gossip_data_column";
pub const SPAN_PROCESS_GOSSIP_BLOB: &str = "process_gossip_blob";
pub const SPAN_PROCESS_GOSSIP_BLOCK: &str = "process_gossip_block";

/// Sync methods root spans
pub const SPAN_SYNCING_CHAIN: &str = "syncing_chain";
pub const SPAN_OUTGOING_RANGE_REQUEST: &str = "outgoing_range_request";
pub const SPAN_OUTGOING_CUSTODY_REQUEST: &str = "outgoing_custody_request";
pub const SPAN_PROCESS_RPC_BLOCK: &str = "process_rpc_block";
pub const SPAN_PROCESS_RPC_BLOBS: &str = "process_rpc_blobs";
pub const SPAN_PROCESS_RPC_CUSTODY_COLUMNS: &str = "process_rpc_custody_columns";
pub const SPAN_PROCESS_CHAIN_SEGMENT: &str = "process_chain_segment";

/// RPC methods root spans
pub const SPAN_HANDLE_BLOCKS_BY_RANGE_REQUEST: &str = "handle_blocks_by_range_request";
pub const SPAN_HANDLE_BLOBS_BY_RANGE_REQUEST: &str = "handle_blobs_by_range_request";
pub const SPAN_HANDLE_DATA_COLUMNS_BY_RANGE_REQUEST: &str = "handle_data_columns_by_range_request";
pub const SPAN_HANDLE_BLOCKS_BY_ROOT_REQUEST: &str = "handle_blocks_by_root_request";
pub const SPAN_HANDLE_BLOBS_BY_ROOT_REQUEST: &str = "handle_blobs_by_root_request";
pub const SPAN_HANDLE_DATA_COLUMNS_BY_ROOT_REQUEST: &str = "handle_data_columns_by_root_request";
pub const SPAN_HANDLE_LIGHT_CLIENT_UPDATES_BY_RANGE: &str = "handle_light_client_updates_by_range";
pub const SPAN_HANDLE_LIGHT_CLIENT_BOOTSTRAP: &str = "handle_light_client_bootstrap";
pub const SPAN_HANDLE_LIGHT_CLIENT_OPTIMISTIC_UPDATE: &str =
"handle_light_client_optimistic_update";
pub const SPAN_HANDLE_LIGHT_CLIENT_FINALITY_UPDATE: &str = "handle_light_client_finality_update";

/// List of all root span names that are allowed to be exported to the tracing backend.
/// Only these spans and their descendants will be processed to reduce noise from
/// uninstrumented code paths. New root spans must be added to this list to be traced.
pub const LH_BN_ROOT_SPAN_NAMES: &[&str] = &[
SPAN_SYNCING_CHAIN,
SPAN_PENDING_COMPONENTS,
SPAN_PROCESS_GOSSIP_DATA_COLUMN,
SPAN_PROCESS_GOSSIP_BLOB,
SPAN_PROCESS_GOSSIP_BLOCK,
SPAN_OUTGOING_RANGE_REQUEST,
SPAN_OUTGOING_CUSTODY_REQUEST,
SPAN_PROCESS_RPC_BLOCK,
SPAN_PROCESS_RPC_BLOBS,
SPAN_PROCESS_RPC_CUSTODY_COLUMNS,
SPAN_PROCESS_CHAIN_SEGMENT,
SPAN_HANDLE_BLOCKS_BY_RANGE_REQUEST,
SPAN_HANDLE_BLOBS_BY_RANGE_REQUEST,
SPAN_HANDLE_DATA_COLUMNS_BY_RANGE_REQUEST,
SPAN_HANDLE_BLOCKS_BY_ROOT_REQUEST,
SPAN_HANDLE_BLOBS_BY_ROOT_REQUEST,
SPAN_HANDLE_DATA_COLUMNS_BY_ROOT_REQUEST,
SPAN_HANDLE_LIGHT_CLIENT_UPDATES_BY_RANGE,
SPAN_HANDLE_LIGHT_CLIENT_BOOTSTRAP,
SPAN_HANDLE_LIGHT_CLIENT_OPTIMISTIC_UPDATE,
SPAN_HANDLE_LIGHT_CLIENT_FINALITY_UPDATE,
];
1 change: 1 addition & 0 deletions beacon_node/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ hex = { workspace = true }
igd-next = { version = "0.16", features = ["aio_tokio"] }
itertools = { workspace = true }
lighthouse_network = { workspace = true }
lighthouse_tracing = { workspace = true }
logging = { workspace = true }
lru_cache = { workspace = true }
metrics = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ use beacon_chain::{
};
use beacon_processor::{Work, WorkEvent};
use lighthouse_network::{Client, MessageAcceptance, MessageId, PeerAction, PeerId, ReportSource};
use lighthouse_tracing::{
SPAN_PROCESS_GOSSIP_BLOB, SPAN_PROCESS_GOSSIP_BLOCK, SPAN_PROCESS_GOSSIP_DATA_COLUMN,
};
use logging::crit;
use operation_pool::ReceivedPreCapella;
use slot_clock::SlotClock;
Expand Down Expand Up @@ -602,7 +605,13 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
}
}

#[instrument(skip_all, level = "trace", fields(slot = ?column_sidecar.slot(), block_root = ?column_sidecar.block_root(), index = column_sidecar.index), parent = None)]
#[instrument(
name = SPAN_PROCESS_GOSSIP_DATA_COLUMN,
parent = None,
level = "debug",
skip_all,
fields(slot = ?column_sidecar.slot(), block_root = ?column_sidecar.block_root(), index = column_sidecar.index),
)]
pub async fn process_gossip_data_column_sidecar(
self: &Arc<Self>,
message_id: MessageId,
Expand Down Expand Up @@ -760,7 +769,16 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
}

#[allow(clippy::too_many_arguments)]
#[instrument(skip_all, level = "trace", fields(slot = ?blob_sidecar.slot(), block_root = ?blob_sidecar.block_root(), index = blob_sidecar.index), parent = None)]
#[instrument(
name = SPAN_PROCESS_GOSSIP_BLOB,
parent = None,
level = "debug",
skip_all,
fields(
slot = ?blob_sidecar.slot(),
block_root = ?blob_sidecar.block_root(),
index = blob_sidecar.index),
)]
pub async fn process_gossip_blob(
self: &Arc<Self>,
message_id: MessageId,
Expand Down Expand Up @@ -1098,7 +1116,13 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
///
/// Raises a log if there are errors.
#[allow(clippy::too_many_arguments)]
#[instrument(skip_all, fields(block_root = tracing::field::Empty), parent = None)]
#[instrument(
name = SPAN_PROCESS_GOSSIP_BLOCK,
parent = None,
level = "debug",
skip_all,
fields(block_root = tracing::field::Empty),
)]
pub async fn process_gossip_block(
self: Arc<Self>,
message_id: MessageId,
Expand Down
Loading
Loading