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

@@ -2,9 +2,8 @@ use std::collections::HashMap;
use std::sync::Arc;
use itertools::Itertools;
use slog::{debug, Logger};
use oneshot_broadcast::{oneshot, Receiver, Sender};
use tracing::debug;
use types::{
beacon_state::CommitteeCache, AttestationShufflingId, BeaconState, Epoch, EthSpec, Hash256,
RelativeEpoch,
@@ -61,16 +60,14 @@ pub struct ShufflingCache {
cache: HashMap<AttestationShufflingId, CacheItem>,
cache_size: usize,
head_shuffling_ids: BlockShufflingIds,
logger: Logger,
}
impl ShufflingCache {
pub fn new(cache_size: usize, head_shuffling_ids: BlockShufflingIds, logger: Logger) -> Self {
pub fn new(cache_size: usize, head_shuffling_ids: BlockShufflingIds) -> Self {
Self {
cache: HashMap::new(),
cache_size,
head_shuffling_ids,
logger,
}
}
@@ -179,10 +176,9 @@ impl ShufflingCache {
for shuffling_id in shuffling_ids_to_prune.iter() {
debug!(
self.logger,
"Removing old shuffling from cache";
"shuffling_epoch" => shuffling_id.shuffling_epoch,
"shuffling_decision_block" => ?shuffling_id.shuffling_decision_block
shuffling_epoch = %shuffling_id.shuffling_epoch,
shuffling_decision_block = ?shuffling_id.shuffling_decision_block,
"Removing old shuffling from cache"
);
self.cache.remove(shuffling_id);
}
@@ -294,10 +290,10 @@ impl BlockShufflingIds {
#[cfg(not(debug_assertions))]
#[cfg(test)]
mod test {
use task_executor::test_utils::test_logger;
use types::*;
use crate::test_utils::EphemeralHarnessType;
use logging::create_test_tracing_subscriber;
use super::*;
@@ -308,6 +304,8 @@ mod test {
// Creates a new shuffling cache for testing
fn new_shuffling_cache() -> ShufflingCache {
create_test_tracing_subscriber();
let current_epoch = 8;
let head_shuffling_ids = BlockShufflingIds {
current: shuffling_id(current_epoch),
@@ -315,8 +313,8 @@ mod test {
previous: Some(shuffling_id(current_epoch - 1)),
block_root: Hash256::from_low_u64_le(0),
};
let logger = test_logger();
ShufflingCache::new(TEST_CACHE_SIZE, head_shuffling_ids, logger)
ShufflingCache::new(TEST_CACHE_SIZE, head_shuffling_ids)
}
/// Returns two different committee caches for testing.