Downgrade duplication log of attestation to Debug (#6007)

* Test

* Simplify

* summary_opt

* Simplify

* Test

* fix

* move to warn

* Revise

* Downgrade to debug

* Add block

* Put inside individual tracking
This commit is contained in:
chonghe
2024-07-04 11:57:23 +08:00
committed by GitHub
parent 4cfdd82aed
commit d9ad1f5bfa

View File

@@ -1383,17 +1383,43 @@ impl<E: EthSpec> ValidatorMonitor<E> {
}); });
if self.individual_tracking() { if self.individual_tracking() {
info!( let is_first_inclusion_aggregate = validator
self.log, .get_from_epoch_summary(epoch, |summary_opt| {
"Attestation included in aggregate"; if let Some(summary) = summary_opt {
"head" => ?data.beacon_block_root, Some(summary.attestation_aggregate_inclusions == 0)
"index" => %data.index, } else {
"delay_ms" => %delay.as_millis(), // No data for this validator: no inclusion.
"epoch" => %epoch, Some(true)
"slot" => %data.slot, }
"src" => src, })
"validator" => %id, .unwrap_or(true);
);
if is_first_inclusion_aggregate {
info!(
self.log,
"Attestation included in aggregate";
"head" => ?data.beacon_block_root,
"index" => %data.index,
"delay_ms" => %delay.as_millis(),
"epoch" => %epoch,
"slot" => %data.slot,
"src" => src,
"validator" => %id,
);
} else {
// Downgrade to Debug for second and onwards of logging to reduce verbosity
debug!(
self.log,
"Attestation included in aggregate";
"head" => ?data.beacon_block_root,
"index" => %data.index,
"delay_ms" => %delay.as_millis(),
"epoch" => %epoch,
"slot" => %data.slot,
"src" => src,
"validator" => %id,
)
};
} }
validator.with_epoch_summary(epoch, |summary| { validator.with_epoch_summary(epoch, |summary| {
@@ -1434,7 +1460,6 @@ impl<E: EthSpec> ValidatorMonitor<E> {
&["block", label], &["block", label],
); );
}); });
if self.individual_tracking() { if self.individual_tracking() {
metrics::set_int_gauge( metrics::set_int_gauge(
&metrics::VALIDATOR_MONITOR_ATTESTATION_IN_BLOCK_DELAY_SLOTS, &metrics::VALIDATOR_MONITOR_ATTESTATION_IN_BLOCK_DELAY_SLOTS,
@@ -1442,16 +1467,41 @@ impl<E: EthSpec> ValidatorMonitor<E> {
delay.as_u64() as i64, delay.as_u64() as i64,
); );
info!( let is_first_inclusion_block = validator
self.log, .get_from_epoch_summary(epoch, |summary_opt| {
"Attestation included in block"; if let Some(summary) = summary_opt {
"head" => ?data.beacon_block_root, Some(summary.attestation_block_inclusions == 0)
"index" => %data.index, } else {
"inclusion_lag" => format!("{} slot(s)", delay), // No data for this validator: no inclusion.
"epoch" => %epoch, Some(true)
"slot" => %data.slot, }
"validator" => %id, })
); .unwrap_or(true);
if is_first_inclusion_block {
info!(
self.log,
"Attestation included in block";
"head" => ?data.beacon_block_root,
"index" => %data.index,
"inclusion_lag" => format!("{} slot(s)", delay),
"epoch" => %epoch,
"slot" => %data.slot,
"validator" => %id,
);
} else {
// Downgrade to Debug for second and onwards of logging to reduce verbosity
debug!(
self.log,
"Attestation included in block";
"head" => ?data.beacon_block_root,
"index" => %data.index,
"inclusion_lag" => format!("{} slot(s)", delay),
"epoch" => %epoch,
"slot" => %data.slot,
"validator" => %id,
);
}
} }
validator.with_epoch_summary(epoch, |summary| { validator.with_epoch_summary(epoch, |summary| {