Skip to content

Commit

Permalink
feat: add metric for blocks per minute
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodus committed Nov 29, 2023
1 parent 26ecb09 commit bf9cb4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions graph-gateway/src/chains/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ impl Actor {
with_metric(&METRICS.chain_head, &[&self.chain], |g| {
g.set(head.block.number as i64)
});
with_metric(&METRICS.blocks_per_minute, &[&self.chain], |g| {
g.set(blocks_per_minute as i64)
});

self.chain_head_tx.write(head.block);
}

Expand Down
7 changes: 7 additions & 0 deletions graph-gateway/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct Metrics {
pub block_cache_hit: IntCounterVec,
pub block_cache_miss: IntCounterVec,
pub chain_head: IntGaugeVec,
pub blocks_per_minute: IntGaugeVec,
pub indexer_selection_duration: Histogram,
}

Expand Down Expand Up @@ -71,6 +72,12 @@ impl Metrics {
&["chain"]
)
.unwrap(),
blocks_per_minute: register_int_gauge_vec!(
"gw_blocks_per_minute",
"chain blocks per minute",
&["chain"]
)
.unwrap(),
indexer_selection_duration: register_histogram!(
"gw_indexer_selection_duration",
"indexer selection duration"
Expand Down

0 comments on commit bf9cb4f

Please sign in to comment.