mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +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:
@@ -34,10 +34,11 @@ rayon = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
serde_yaml = { workspace = true }
|
||||
sloggers = { workspace = true }
|
||||
snap = { workspace = true }
|
||||
state_processing = { workspace = true }
|
||||
store = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
tree_hash = { workspace = true }
|
||||
types = { workspace = true }
|
||||
validator_dir = { workspace = true }
|
||||
|
||||
@@ -32,9 +32,9 @@ use clap_utils::{parse_optional, parse_required};
|
||||
use environment::Environment;
|
||||
use eth2::{types::BlockId, BeaconNodeHttpClient, SensitiveUrl, Timeouts};
|
||||
use eth2_network_config::Eth2NetworkConfig;
|
||||
use log::info;
|
||||
use std::path::PathBuf;
|
||||
use std::time::{Duration, Instant};
|
||||
use tracing::info;
|
||||
use types::{EthSpec, FullPayload, SignedBeaconBlock};
|
||||
|
||||
const HTTP_TIMEOUT: Duration = Duration::from_secs(5);
|
||||
@@ -102,7 +102,7 @@ pub fn run<E: EthSpec>(
|
||||
}
|
||||
|
||||
if let Some(block_root) = block_root {
|
||||
info!("Block root is {:?}", block_root);
|
||||
info!(%block_root,"Block root");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -18,6 +18,7 @@ use parse_ssz::run_parse_ssz;
|
||||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
use std::str::FromStr;
|
||||
use tracing_subscriber::filter::LevelFilter;
|
||||
use types::{EthSpec, EthSpecId};
|
||||
|
||||
fn main() {
|
||||
@@ -643,24 +644,31 @@ fn main() {
|
||||
}
|
||||
|
||||
fn run<E: EthSpec>(env_builder: EnvironmentBuilder<E>, matches: &ArgMatches) -> Result<(), String> {
|
||||
let (env_builder, _file_logging_layer, _stdout_logging_layer, _sse_logging_layer_opt) =
|
||||
env_builder
|
||||
.multi_threaded_tokio_runtime()
|
||||
.map_err(|e| format!("should start tokio runtime: {:?}", e))?
|
||||
.init_tracing(
|
||||
LoggerConfig {
|
||||
path: None,
|
||||
debug_level: LevelFilter::TRACE,
|
||||
logfile_debug_level: LevelFilter::TRACE,
|
||||
log_format: None,
|
||||
logfile_format: None,
|
||||
log_color: true,
|
||||
logfile_color: false,
|
||||
disable_log_timestamp: false,
|
||||
max_log_size: 0,
|
||||
max_log_number: 0,
|
||||
compression: false,
|
||||
is_restricted: true,
|
||||
sse_logging: false, // No SSE Logging in LCLI
|
||||
extra_info: false,
|
||||
},
|
||||
"",
|
||||
);
|
||||
|
||||
let env = env_builder
|
||||
.multi_threaded_tokio_runtime()
|
||||
.map_err(|e| format!("should start tokio runtime: {:?}", e))?
|
||||
.initialize_logger(LoggerConfig {
|
||||
path: None,
|
||||
debug_level: String::from("trace"),
|
||||
logfile_debug_level: String::from("trace"),
|
||||
log_format: None,
|
||||
logfile_format: None,
|
||||
log_color: false,
|
||||
disable_log_timestamp: false,
|
||||
max_log_size: 0,
|
||||
max_log_number: 0,
|
||||
compression: false,
|
||||
is_restricted: true,
|
||||
sse_logging: false, // No SSE Logging in LCLI
|
||||
})
|
||||
.map_err(|e| format!("should start logger: {:?}", e))?
|
||||
.build()
|
||||
.map_err(|e| format!("should build env: {:?}", e))?;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use clap::ArgMatches;
|
||||
use clap_utils::parse_required;
|
||||
use eth2_network_config::Eth2NetworkConfig;
|
||||
use log::info;
|
||||
use serde::Serialize;
|
||||
use snap::raw::Decoder;
|
||||
use ssz::Decode;
|
||||
@@ -9,6 +8,7 @@ use std::fs;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::str::FromStr;
|
||||
use tracing::info;
|
||||
use types::*;
|
||||
|
||||
enum OutputFormat {
|
||||
@@ -59,7 +59,7 @@ pub fn run_parse_ssz<E: EthSpec>(
|
||||
spec.config_name.as_deref().unwrap_or("unknown"),
|
||||
E::spec_name()
|
||||
);
|
||||
info!("Type: {type_str}");
|
||||
info!(%type_str, "Type");
|
||||
|
||||
// More fork-specific decoders may need to be added in future, but shouldn't be 100% necessary,
|
||||
// as the fork-generic decoder will always be available (requires correct --network flag).
|
||||
|
||||
@@ -50,7 +50,6 @@ use clap_utils::{parse_optional, parse_required};
|
||||
use environment::Environment;
|
||||
use eth2::{types::StateId, BeaconNodeHttpClient, SensitiveUrl, Timeouts};
|
||||
use eth2_network_config::Eth2NetworkConfig;
|
||||
use log::info;
|
||||
use ssz::Encode;
|
||||
use state_processing::state_advance::{complete_state_advance, partial_state_advance};
|
||||
use state_processing::AllCaches;
|
||||
@@ -58,6 +57,7 @@ use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
use std::path::PathBuf;
|
||||
use std::time::{Duration, Instant};
|
||||
use tracing::info;
|
||||
use types::{BeaconState, EthSpec, Hash256};
|
||||
|
||||
const HTTP_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
|
||||
@@ -4,9 +4,9 @@ use clap_utils::{parse_optional, parse_required};
|
||||
use environment::Environment;
|
||||
use eth2::{types::StateId, BeaconNodeHttpClient, SensitiveUrl, Timeouts};
|
||||
use eth2_network_config::Eth2NetworkConfig;
|
||||
use log::info;
|
||||
use std::path::PathBuf;
|
||||
use std::time::{Duration, Instant};
|
||||
use tracing::info;
|
||||
use types::{BeaconState, EthSpec};
|
||||
|
||||
const HTTP_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
|
||||
@@ -72,8 +72,6 @@ use eth2::{
|
||||
BeaconNodeHttpClient, SensitiveUrl, Timeouts,
|
||||
};
|
||||
use eth2_network_config::Eth2NetworkConfig;
|
||||
use log::{debug, info};
|
||||
use sloggers::{null::NullLoggerBuilder, Build};
|
||||
use ssz::Encode;
|
||||
use state_processing::state_advance::complete_state_advance;
|
||||
use state_processing::{
|
||||
@@ -87,6 +85,7 @@ use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
use store::HotColdDB;
|
||||
use tracing::{debug, info};
|
||||
use types::{BeaconState, ChainSpec, EthSpec, Hash256, SignedBeaconBlock};
|
||||
|
||||
const HTTP_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
@@ -196,14 +195,8 @@ pub fn run<E: EthSpec>(
|
||||
* Create a `BeaconStore` and `ValidatorPubkeyCache` for block signature verification.
|
||||
*/
|
||||
|
||||
let store = HotColdDB::open_ephemeral(
|
||||
<_>::default(),
|
||||
spec.clone(),
|
||||
NullLoggerBuilder
|
||||
.build()
|
||||
.map_err(|e| format!("Error on NullLoggerBuilder: {:?}", e))?,
|
||||
)
|
||||
.map_err(|e| format!("Failed to create ephemeral store: {:?}", e))?;
|
||||
let store = HotColdDB::open_ephemeral(<_>::default(), spec.clone())
|
||||
.map_err(|e| format!("Failed to create ephemeral store: {:?}", e))?;
|
||||
let store = Arc::new(store);
|
||||
|
||||
debug!("Building pubkey cache (might take some time)");
|
||||
|
||||
Reference in New Issue
Block a user