mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 04:01:51 +00:00
Instrument tracing spans for block processing and import (#7816)
#7815 - removes all existing spans, so some span fields that appear in logs like `service_name` may be lost. - instruments a few key code paths in the beacon node, starting from **root spans** named below: * Gossip block and blobs * `process_gossip_data_column_sidecar` * `process_gossip_blob` * `process_gossip_block` * Rpc block and blobs * `process_rpc_block` * `process_rpc_blobs` * `process_rpc_custody_columns` * Rpc blocks (range and backfill) * `process_chain_segment` * `PendingComponents` lifecycle * `pending_components` To test locally: * Run Grafana and Tempo with https://github.com/sigp/lighthouse-metrics/pull/57 * Run Lighthouse BN with `--telemetry-collector-url http://localhost:4317` Some captured traces can be found here: https://hackmd.io/@jimmygchen/r1sLOxPPeg Removing the old spans seem to have reduced the memory usage quite a lot - i think we were using them on long running tasks and too excessively: <img width="910" height="495" alt="image" src="https://github.com/user-attachments/assets/5208bbe4-53b2-4ead-bc71-0b782c788669" />
This commit is contained in:
@@ -4,6 +4,7 @@ use crate::upgrade::{
|
||||
};
|
||||
use crate::{per_epoch_processing::EpochProcessingSummary, *};
|
||||
use safe_arith::{ArithError, SafeArith};
|
||||
use tracing::instrument;
|
||||
use types::*;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@@ -25,6 +26,7 @@ impl From<ArithError> for Error {
|
||||
/// If the root of the supplied `state` is known, then it can be passed as `state_root`. If
|
||||
/// `state_root` is `None`, the root of `state` will be computed using a cached tree hash.
|
||||
/// Providing the `state_root` makes this function several orders of magnitude faster.
|
||||
#[instrument(skip_all)]
|
||||
pub fn per_slot_processing<E: EthSpec>(
|
||||
state: &mut BeaconState<E>,
|
||||
state_root: Option<Hash256>,
|
||||
@@ -85,6 +87,7 @@ pub fn per_slot_processing<E: EthSpec>(
|
||||
Ok(summary)
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
fn cache_state<E: EthSpec>(
|
||||
state: &mut BeaconState<E>,
|
||||
state_root: Option<Hash256>,
|
||||
|
||||
Reference in New Issue
Block a user