Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish EL Info in Metrics #7052

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions beacon_node/execution_layer/src/engine_api/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,10 @@ impl HttpJsonRpc {
} else {
let engine_version = self.get_client_version_v1().await?;
*lock = Some(CachedResponse::new(engine_version.clone()));
if !engine_version.is_empty() {
// reset metric gauge when there's a fresh fetch
crate::metrics::reset_execution_layer_info_gauge();
}
Ok(engine_version)
}
}
Expand Down
8 changes: 6 additions & 2 deletions beacon_node/execution_layer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1587,10 +1587,14 @@ impl<E: EthSpec> ExecutionLayer<E> {
&self,
age_limit: Option<Duration>,
) -> Result<Vec<ClientVersionV1>, Error> {
self.engine()
let versions = self
.engine()
.request(|engine| engine.get_engine_version(age_limit))
.await
.map_err(Into::into)
.map_err(Into::<Error>::into)?;
metrics::expose_execution_layer_info(&versions);

Ok(versions)
}

/// Used during block production to determine if the merge has been triggered.
Expand Down
26 changes: 26 additions & 0 deletions beacon_node/execution_layer/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,29 @@ pub static EXECUTION_LAYER_PAYLOAD_BIDS: LazyLock<Result<IntGaugeVec>> = LazyLoc
&["source"]
)
});
pub static EXECUTION_LAYER_INFO: LazyLock<Result<IntGaugeVec>> = LazyLock::new(|| {
try_create_int_gauge_vec(
"execution_layer_info",
"The build of the execution layer connected to lighthouse",
&["code", "name", "version", "commit"],
)
});

pub fn reset_execution_layer_info_gauge() {
let _ = EXECUTION_LAYER_INFO.as_ref().map(|gauge| gauge.reset());
}

pub fn expose_execution_layer_info(els: &Vec<crate::ClientVersionV1>) {
for el in els {
set_gauge_vec(
&EXECUTION_LAYER_INFO,
&[
&el.code.to_string(),
&el.name,
&el.version,
&el.commit.to_string(),
],
1,
);
}
}