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

@@ -9,11 +9,11 @@ use bytes::Bytes;
use execution_block_generator::PoWBlock;
use handle_rpc::handle_rpc;
use kzg::Kzg;
use logging::test_logger;
use logging::create_test_tracing_subscriber;
use parking_lot::{Mutex, RwLock, RwLockWriteGuard};
use serde::{Deserialize, Serialize};
use serde_json::json;
use slog::{info, Logger};
use std::collections::HashMap;
use std::convert::Infallible;
use std::future::Future;
@@ -21,6 +21,7 @@ use std::marker::PhantomData;
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
use std::sync::{Arc, LazyLock};
use tokio::{runtime, sync::oneshot};
use tracing::info;
use types::{ChainSpec, EthSpec, ExecutionBlockHash, Uint256};
use warp::{http::StatusCode, Filter, Rejection};
@@ -133,6 +134,7 @@ impl<E: EthSpec> MockServer<E> {
spec: Arc<ChainSpec>,
kzg: Option<Arc<Kzg>>,
) -> Self {
create_test_tracing_subscriber();
let MockExecutionConfig {
jwt_key,
terminal_difficulty,
@@ -161,7 +163,6 @@ impl<E: EthSpec> MockServer<E> {
let ctx: Arc<Context<E>> = Arc::new(Context {
config: server_config,
jwt_key,
log: test_logger(),
last_echo_request: last_echo_request.clone(),
execution_block_generator: RwLock::new(execution_block_generator),
previous_request: <_>::default(),
@@ -533,7 +534,7 @@ impl warp::reject::Reject for AuthError {}
pub struct Context<E: EthSpec> {
pub config: Config,
pub jwt_key: JwtKey,
pub log: Logger,
pub last_echo_request: Arc<RwLock<Option<Bytes>>>,
pub execution_block_generator: RwLock<ExecutionBlockGenerator<E>>,
pub preloaded_responses: Arc<Mutex<Vec<serde_json::Value>>>,
@@ -671,7 +672,6 @@ pub fn serve<E: EthSpec>(
shutdown: impl Future<Output = ()> + Send + Sync + 'static,
) -> Result<(SocketAddr, impl Future<Output = ()>), Error> {
let config = &ctx.config;
let log = ctx.log.clone();
let inner_ctx = ctx.clone();
let ctx_filter = warp::any().map(move || inner_ctx.clone());
@@ -751,9 +751,8 @@ pub fn serve<E: EthSpec>(
)?;
info!(
log,
"Metrics HTTP server started";
"listen_address" => listening_socket.to_string(),
listen_address = listening_socket.to_string(),
"Metrics HTTP server started"
);
Ok((listening_socket, server))