Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions beacon_node/client/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ pub static IS_SYNCED: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
)
});

pub static IS_OPTIMISTIC_SYNC: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
try_create_int_gauge(
"optimistic_sync",
"Metric to check if the beacon chain is in optimistic sync mode. 0 if optimistic sync and 1 if synced",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is counterintuitive. In my original comment I was thinking we would name the metric something like execution_verified 0|1, with 0 representing the optimistic case and 1 representing full sync. Or if we keep the optimistic_sync name I think we should swap it so that 1 = optimistic, 0 = not optimistic. That might actually be the clearest. We would just need to display the 0 as "good" in our grafana chart

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised in revise

If you think the metric should be placed in another place (e.g., execution layer metrics) and rename to execution_verified, then I can revise to that

)
});

pub static NOTIFIER_HEAD_SLOT: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
try_create_int_gauge(
"notifier_head_slot",
Expand Down
6 changes: 5 additions & 1 deletion beacon_node/client/src/notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,12 @@ pub fn spawn_notifier<T: BeaconChainTypes>(

let block_hash = match beacon_chain.canonical_head.head_execution_status() {
Ok(ExecutionStatus::Irrelevant(_)) => "n/a".to_string(),
Ok(ExecutionStatus::Valid(hash)) => format!("{} (verified)", hash),
Ok(ExecutionStatus::Valid(hash)) => {
metrics::set_gauge(&metrics::IS_OPTIMISTIC_SYNC, 1);
format!("{} (verified)", hash)
}
Ok(ExecutionStatus::Optimistic(hash)) => {
metrics::set_gauge(&metrics::IS_OPTIMISTIC_SYNC, 0);
warn!(
info = "chain not fully verified, \
block and attestation production disabled until execution engine syncs",
Expand Down
Loading