mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 02:01:40 +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:
@@ -10,5 +10,5 @@ mockito = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
sensitive_url = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
slog = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
types = { workspace = true }
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
use eth2::types::{GenericResponse, SyncingData};
|
||||
use eth2::{BeaconNodeHttpClient, StatusCode, Timeouts};
|
||||
use logging::test_logger;
|
||||
use mockito::{Matcher, Mock, Server, ServerGuard};
|
||||
use regex::Regex;
|
||||
use sensitive_url::SensitiveUrl;
|
||||
use slog::{info, Logger};
|
||||
use std::marker::PhantomData;
|
||||
use std::str::FromStr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
use tracing::info;
|
||||
use types::{ChainSpec, ConfigAndPreset, EthSpec, SignedBlindedBeaconBlock};
|
||||
|
||||
pub struct MockBeaconNode<E: EthSpec> {
|
||||
server: ServerGuard,
|
||||
pub beacon_api_client: BeaconNodeHttpClient,
|
||||
log: Logger,
|
||||
_phantom: PhantomData<E>,
|
||||
pub received_blocks: Arc<Mutex<Vec<SignedBlindedBeaconBlock<E>>>>,
|
||||
}
|
||||
@@ -27,11 +25,9 @@ impl<E: EthSpec> MockBeaconNode<E> {
|
||||
SensitiveUrl::from_str(&server.url()).unwrap(),
|
||||
Timeouts::set_all(Duration::from_secs(1)),
|
||||
);
|
||||
let log = test_logger();
|
||||
Self {
|
||||
server,
|
||||
beacon_api_client,
|
||||
log,
|
||||
_phantom: PhantomData,
|
||||
received_blocks: Arc::new(Mutex::new(Vec::new())),
|
||||
}
|
||||
@@ -69,7 +65,6 @@ impl<E: EthSpec> MockBeaconNode<E> {
|
||||
/// Mocks the `post_beacon_blinded_blocks_v2_ssz` response with an optional `delay`.
|
||||
pub fn mock_post_beacon_blinded_blocks_v2_ssz(&mut self, delay: Duration) -> Mock {
|
||||
let path_pattern = Regex::new(r"^/eth/v2/beacon/blinded_blocks$").unwrap();
|
||||
let log = self.log.clone();
|
||||
let url = self.server.url();
|
||||
|
||||
let received_blocks = Arc::clone(&self.received_blocks);
|
||||
@@ -80,7 +75,6 @@ impl<E: EthSpec> MockBeaconNode<E> {
|
||||
.with_status(200)
|
||||
.with_body_from_request(move |request| {
|
||||
info!(
|
||||
log,
|
||||
"{}",
|
||||
format!(
|
||||
"Received published block request on server {} with delay {} s",
|
||||
|
||||
Reference in New Issue
Block a user