Skip to content
Merged
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
3 changes: 3 additions & 0 deletions bin/ethlambda/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ async fn main() -> eyre::Result<()> {
// Set node info metrics
ethlambda_blockchain::metrics::set_node_info("ethlambda", version::CLIENT_VERSION);
ethlambda_blockchain::metrics::set_node_start_time();
ethlambda_blockchain::metrics::set_attestation_committee_count(
options.attestation_committee_count,
);

let api_socket = SocketAddr::new(options.http_address, options.api_port);
let metrics_socket = SocketAddr::new(options.http_address, options.metrics_port);
Expand Down
13 changes: 13 additions & 0 deletions crates/blockchain/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,19 @@ pub fn set_is_aggregator(is_aggregator: bool) {
LEAN_IS_AGGREGATOR.set(i64::from(is_aggregator));
}

/// Set the attestation committee count gauge.
pub fn set_attestation_committee_count(count: u64) {
static LEAN_ATTESTATION_COMMITTEE_COUNT: std::sync::LazyLock<IntGauge> =
std::sync::LazyLock::new(|| {
register_int_gauge!(
"lean_attestation_committee_count",
"Number of attestation committees (ATTESTATION_COMMITTEE_COUNT)"
)
.unwrap()
});
LEAN_ATTESTATION_COMMITTEE_COUNT.set(count.try_into().unwrap_or_default());
}

/// Observe the depth of a fork choice reorg.
pub fn observe_fork_choice_reorg_depth(depth: u64) {
static LEAN_FORK_CHOICE_REORG_DEPTH: std::sync::LazyLock<Histogram> =
Expand Down
1 change: 1 addition & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ The exposed metrics follow [the leanMetrics specification](https://github.com/le

| Name | Type | Usage | Sample collection event | Labels | Supported |
|--------|-------|-------|-------------------------|--------|-----------|
|`lean_attestation_committee_count`| Gauge | Number of attestation committees | On node start | | ✅ |
|`lean_connected_peers`| Gauge | Number of connected peers | On scrape | client=ethlambda,grandine,lantern,lighthouse,qlean,ream,zeam | ✅(*) |
|`lean_peer_connection_events_total`| Counter | Total number of peer connection events | On peer connection | direction=inbound,outbound<br>result=success,timeout,error | ✅ |
|`lean_peer_disconnection_events_total`| Counter | Total number of peer disconnection events | On peer disconnection | direction=inbound,outbound<br>reason=timeout,remote_close,local_close,error | ✅ |
Expand Down
Loading