mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 18:21:45 +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:
@@ -8,10 +8,11 @@ edition = { workspace = true }
|
||||
[dependencies]
|
||||
ethereum_ssz = { workspace = true }
|
||||
ethereum_ssz_derive = { workspace = true }
|
||||
logging = { workspace = true }
|
||||
metrics = { workspace = true }
|
||||
proto_array = { workspace = true }
|
||||
slog = { workspace = true }
|
||||
state_processing = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
types = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use crate::metrics::{self, scrape_for_metrics};
|
||||
use crate::{ForkChoiceStore, InvalidationOperation};
|
||||
use logging::crit;
|
||||
use proto_array::{
|
||||
Block as ProtoBlock, DisallowedReOrgOffsets, ExecutionStatus, ProposerHeadError,
|
||||
ProposerHeadInfo, ProtoArrayForkChoice, ReOrgThreshold,
|
||||
};
|
||||
use slog::{crit, debug, warn, Logger};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use state_processing::{
|
||||
per_block_processing::errors::AttesterSlashingValidationError, per_epoch_processing,
|
||||
@@ -13,6 +13,7 @@ use std::cmp::Ordering;
|
||||
use std::collections::BTreeSet;
|
||||
use std::marker::PhantomData;
|
||||
use std::time::Duration;
|
||||
use tracing::{debug, warn};
|
||||
use types::{
|
||||
consts::bellatrix::INTERVALS_PER_SLOT, AbstractExecPayload, AttestationShufflingId,
|
||||
AttesterSlashingRef, BeaconBlockRef, BeaconState, BeaconStateError, ChainSpec, Checkpoint,
|
||||
@@ -1365,17 +1366,14 @@ where
|
||||
persisted: &PersistedForkChoice,
|
||||
reset_payload_statuses: ResetPayloadStatuses,
|
||||
spec: &ChainSpec,
|
||||
log: &Logger,
|
||||
) -> Result<ProtoArrayForkChoice, Error<T::Error>> {
|
||||
let mut proto_array = ProtoArrayForkChoice::from_bytes(&persisted.proto_array_bytes)
|
||||
.map_err(Error::InvalidProtoArrayBytes)?;
|
||||
let contains_invalid_payloads = proto_array.contains_invalid_payloads();
|
||||
|
||||
debug!(
|
||||
log,
|
||||
"Restoring fork choice from persisted";
|
||||
"reset_payload_statuses" => ?reset_payload_statuses,
|
||||
"contains_invalid_payloads" => contains_invalid_payloads,
|
||||
?reset_payload_statuses,
|
||||
contains_invalid_payloads, "Restoring fork choice from persisted"
|
||||
);
|
||||
|
||||
// Exit early if there are no "invalid" payloads, if requested.
|
||||
@@ -1394,18 +1392,14 @@ where
|
||||
// back to a proto-array which does not have the reset applied. This indicates a
|
||||
// significant error in Lighthouse and warrants detailed investigation.
|
||||
crit!(
|
||||
log,
|
||||
"Failed to reset payload statuses";
|
||||
"error" => e,
|
||||
"info" => "please report this error",
|
||||
error = ?e,
|
||||
info = "please report this error",
|
||||
"Failed to reset payload statuses"
|
||||
);
|
||||
ProtoArrayForkChoice::from_bytes(&persisted.proto_array_bytes)
|
||||
.map_err(Error::InvalidProtoArrayBytes)
|
||||
} else {
|
||||
debug!(
|
||||
log,
|
||||
"Successfully reset all payload statuses";
|
||||
);
|
||||
debug!("Successfully reset all payload statuses");
|
||||
Ok(proto_array)
|
||||
}
|
||||
}
|
||||
@@ -1417,10 +1411,9 @@ where
|
||||
reset_payload_statuses: ResetPayloadStatuses,
|
||||
fc_store: T,
|
||||
spec: &ChainSpec,
|
||||
log: &Logger,
|
||||
) -> Result<Self, Error<T::Error>> {
|
||||
let proto_array =
|
||||
Self::proto_array_from_persisted(&persisted, reset_payload_statuses, spec, log)?;
|
||||
Self::proto_array_from_persisted(&persisted, reset_payload_statuses, spec)?;
|
||||
|
||||
let current_slot = fc_store.get_current_slot();
|
||||
|
||||
@@ -1444,10 +1437,9 @@ where
|
||||
// an optimistic status so that we can have a head to start from.
|
||||
if let Err(e) = fork_choice.get_head(current_slot, spec) {
|
||||
warn!(
|
||||
log,
|
||||
"Could not find head on persisted FC";
|
||||
"info" => "resetting all payload statuses and retrying",
|
||||
"error" => ?e
|
||||
info = "resetting all payload statuses and retrying",
|
||||
error = ?e,
|
||||
"Could not find head on persisted FC"
|
||||
);
|
||||
// Although we may have already made this call whilst loading `proto_array`, try it
|
||||
// again since we may have mutated the `proto_array` during `get_head` and therefore may
|
||||
|
||||
@@ -28,7 +28,6 @@ hex = { workspace = true }
|
||||
int_to_bytes = { workspace = true }
|
||||
itertools = { workspace = true }
|
||||
kzg = { workspace = true }
|
||||
log = { workspace = true }
|
||||
maplit = { workspace = true }
|
||||
merkle_proof = { workspace = true }
|
||||
metastruct = "0.1.0"
|
||||
@@ -44,13 +43,13 @@ safe_arith = { workspace = true }
|
||||
serde = { workspace = true, features = ["rc"] }
|
||||
serde_json = { workspace = true }
|
||||
serde_yaml = { workspace = true }
|
||||
slog = { workspace = true }
|
||||
smallvec = { workspace = true }
|
||||
ssz_types = { workspace = true, features = ["arbitrary"] }
|
||||
superstruct = { workspace = true }
|
||||
swap_or_not_shuffle = { workspace = true, features = ["arbitrary"] }
|
||||
tempfile = { workspace = true }
|
||||
test_random_derive = { path = "../../common/test_random_derive" }
|
||||
tracing = { workspace = true }
|
||||
tree_hash = { workspace = true }
|
||||
tree_hash_derive = { workspace = true }
|
||||
|
||||
|
||||
@@ -227,17 +227,6 @@ macro_rules! impl_display {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl slog::Value for $type {
|
||||
fn serialize(
|
||||
&self,
|
||||
record: &slog::Record,
|
||||
key: slog::Key,
|
||||
serializer: &mut dyn slog::Serializer,
|
||||
) -> slog::Result {
|
||||
slog::Value::serialize(&self.0, record, key, serializer)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::*;
|
||||
use eth2_interop_keypairs::{keypair, keypairs_from_yaml_file};
|
||||
use log::debug;
|
||||
use rayon::prelude::*;
|
||||
use std::path::PathBuf;
|
||||
use tracing::debug;
|
||||
|
||||
/// Generates `validator_count` keypairs where the secret key is derived solely from the index of
|
||||
/// the validator.
|
||||
|
||||
Reference in New Issue
Block a user