Integrate tracing (#6339)

Tracing Integration
- [reference](5bbf1859e9/projects/project-ideas.md (L297))


  - [x] replace slog & log with tracing throughout the codebase
- [x] implement custom crit log
- [x] make relevant changes in the formatter
- [x] replace sloggers
- [x] re-write SSE logging components

cc: @macladson @eserilev
This commit is contained in:
ThreeHrSleep
2025-03-13 04:01:05 +05:30
committed by GitHub
parent f23f984f85
commit d60c24ef1c
241 changed files with 9485 additions and 9328 deletions

View File

@@ -19,8 +19,8 @@ use beacon_chain::{
block_verification_types::{AsBlock, BlockImportData},
data_availability_checker::Availability,
test_utils::{
build_log, generate_rand_block_and_blobs, generate_rand_block_and_data_columns, test_spec,
BeaconChainHarness, EphemeralHarnessType, LoggerType, NumBlobs,
generate_rand_block_and_blobs, generate_rand_block_and_data_columns, test_spec,
BeaconChainHarness, EphemeralHarnessType, NumBlobs,
},
validator_monitor::timestamp_now,
AvailabilityPendingExecutedBlock, AvailabilityProcessingStatus, BlockError,
@@ -37,9 +37,9 @@ use lighthouse_network::{
types::SyncState,
NetworkConfig, NetworkGlobals, PeerId,
};
use slog::info;
use slot_clock::{SlotClock, TestingSlotClock};
use tokio::sync::mpsc;
use tracing::info;
use types::{
data_column_sidecar::ColumnIndex,
test_utils::{SeedableRng, TestRandom, XorShiftRng},
@@ -55,22 +55,12 @@ type DCByRootId = (SyncRequestId, Vec<ColumnIndex>);
impl TestRig {
pub fn test_setup() -> Self {
let logger_type = if cfg!(feature = "test_logger") {
LoggerType::Test
} else if cfg!(feature = "ci_logger") {
LoggerType::CI
} else {
LoggerType::Null
};
let log = build_log(slog::Level::Trace, logger_type);
// Use `fork_from_env` logic to set correct fork epochs
let spec = test_spec::<E>();
// Initialise a new beacon chain
let harness = BeaconChainHarness::<EphemeralHarnessType<E>>::builder(E)
.spec(Arc::new(spec))
.logger(log.clone())
.deterministic_keypairs(1)
.fresh_ephemeral_store()
.mock_execution_layer()
@@ -95,7 +85,6 @@ impl TestRig {
let network_config = Arc::new(NetworkConfig::default());
let globals = Arc::new(NetworkGlobals::new_test_globals(
Vec::new(),
&log,
network_config,
chain.spec.clone(),
));
@@ -104,7 +93,6 @@ impl TestRig {
sync_tx,
chain.clone(),
harness.runtime.task_executor.clone(),
log.clone(),
);
let fork_name = chain.spec.fork_name_at_slot::<E>(chain.slot().unwrap());
@@ -137,11 +125,9 @@ impl TestRig {
required_successes: vec![SAMPLING_REQUIRED_SUCCESSES],
},
fork_context,
log.clone(),
),
harness,
fork_name,
log,
spec,
}
}
@@ -165,7 +151,7 @@ impl TestRig {
}
pub fn log(&self, msg: &str) {
info!(self.log, "TEST_RIG"; "msg" => msg);
info!(msg, "TEST_RIG");
}
pub fn after_deneb(&self) -> bool {
@@ -2318,11 +2304,6 @@ mod deneb_only {
})
}
fn log(self, msg: &str) -> Self {
self.rig.log(msg);
self
}
fn trigger_unknown_block_from_attestation(mut self) -> Self {
let block_root = self.block.canonical_root();
self.rig
@@ -2626,6 +2607,11 @@ mod deneb_only {
.block_imported()
}
fn log(self, msg: &str) -> Self {
self.rig.log(msg);
self
}
fn parent_block_then_empty_parent_blobs(self) -> Self {
self.log(
" Return empty blobs for parent, block errors with missing components, downscore",