mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
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:
@@ -19,10 +19,8 @@ use lighthouse_network::{
|
||||
types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield, SyncState},
|
||||
ConnectedPoint, Enr, NetworkConfig, NetworkGlobals, PeerId, PeerManager,
|
||||
};
|
||||
use logging::test_logger;
|
||||
use network::{NetworkReceivers, NetworkSenders};
|
||||
use sensitive_url::SensitiveUrl;
|
||||
use slog::Logger;
|
||||
use std::future::Future;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
@@ -75,7 +73,6 @@ impl<E: EthSpec> InteractiveTester<E> {
|
||||
) -> Self {
|
||||
let mut harness_builder = BeaconChainHarness::builder(E::default())
|
||||
.spec_or_default(spec.map(Arc::new))
|
||||
.logger(test_logger())
|
||||
.mock_execution_layer();
|
||||
|
||||
harness_builder = if let Some(initializer) = initializer {
|
||||
@@ -102,13 +99,7 @@ impl<E: EthSpec> InteractiveTester<E> {
|
||||
listening_socket,
|
||||
network_rx,
|
||||
..
|
||||
} = create_api_server_with_config(
|
||||
harness.chain.clone(),
|
||||
config,
|
||||
&harness.runtime,
|
||||
harness.logger().clone(),
|
||||
)
|
||||
.await;
|
||||
} = create_api_server_with_config(harness.chain.clone(), config, &harness.runtime).await;
|
||||
|
||||
tokio::spawn(server);
|
||||
|
||||
@@ -134,16 +125,14 @@ impl<E: EthSpec> InteractiveTester<E> {
|
||||
pub async fn create_api_server<T: BeaconChainTypes>(
|
||||
chain: Arc<BeaconChain<T>>,
|
||||
test_runtime: &TestRuntime,
|
||||
log: Logger,
|
||||
) -> ApiServer<T, impl Future<Output = ()>> {
|
||||
create_api_server_with_config(chain, Config::default(), test_runtime, log).await
|
||||
create_api_server_with_config(chain, Config::default(), test_runtime).await
|
||||
}
|
||||
|
||||
pub async fn create_api_server_with_config<T: BeaconChainTypes>(
|
||||
chain: Arc<BeaconChain<T>>,
|
||||
http_config: Config,
|
||||
test_runtime: &TestRuntime,
|
||||
log: Logger,
|
||||
) -> ApiServer<T, impl Future<Output = ()>> {
|
||||
// Use port 0 to allocate a new unused port.
|
||||
let port = 0;
|
||||
@@ -174,14 +163,13 @@ pub async fn create_api_server_with_config<T: BeaconChainTypes>(
|
||||
meta_data,
|
||||
vec![],
|
||||
false,
|
||||
&log,
|
||||
network_config,
|
||||
chain.spec.clone(),
|
||||
));
|
||||
|
||||
// Only a peer manager can add peers, so we create a dummy manager.
|
||||
let config = lighthouse_network::peer_manager::config::Config::default();
|
||||
let mut pm = PeerManager::new(config, network_globals.clone(), &log).unwrap();
|
||||
let mut pm = PeerManager::new(config, network_globals.clone()).unwrap();
|
||||
|
||||
// add a peer
|
||||
let peer_id = PeerId::random();
|
||||
@@ -200,8 +188,7 @@ pub async fn create_api_server_with_config<T: BeaconChainTypes>(
|
||||
}));
|
||||
*network_globals.sync_state.write() = SyncState::Synced;
|
||||
|
||||
let eth1_service =
|
||||
eth1::Service::new(eth1::Config::default(), log.clone(), chain.spec.clone()).unwrap();
|
||||
let eth1_service = eth1::Service::new(eth1::Config::default(), chain.spec.clone()).unwrap();
|
||||
|
||||
let beacon_processor_config = BeaconProcessorConfig {
|
||||
// The number of workers must be greater than one. Tests which use the
|
||||
@@ -225,7 +212,6 @@ pub async fn create_api_server_with_config<T: BeaconChainTypes>(
|
||||
executor: test_runtime.task_executor.clone(),
|
||||
current_workers: 0,
|
||||
config: beacon_processor_config,
|
||||
log: log.clone(),
|
||||
}
|
||||
.spawn_manager(
|
||||
beacon_processor_rx,
|
||||
@@ -258,7 +244,6 @@ pub async fn create_api_server_with_config<T: BeaconChainTypes>(
|
||||
beacon_processor_reprocess_send: Some(reprocess_send),
|
||||
eth1_service: Some(eth1_service),
|
||||
sse_logging_components: None,
|
||||
log,
|
||||
});
|
||||
|
||||
let (listening_socket, server) =
|
||||
|
||||
Reference in New Issue
Block a user