Skip to content

Commit

Permalink
chore(rpc): add cached bytes metric (paradigmxyz#3502)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrasiuk authored Jun 30, 2023
1 parent f08a863 commit 10db786
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/rpc/rpc/src/eth/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ where
}

fn update_cached_metrics(&self) {
self.full_block_cache.update_cached_count();
self.receipts_cache.update_cached_count();
self.evm_env_cache.update_cached_count();
self.full_block_cache.update_cached_metrics();
self.receipts_cache.update_cached_metrics();
self.evm_env_cache.update_cached_metrics();
}
}

Expand Down Expand Up @@ -507,8 +507,9 @@ where
}
}

fn update_cached_count(&self) {
fn update_cached_metrics(&self) {
self.metrics.cached_count.set(self.cache.len() as f64);
self.metrics.cached_bytes.set(self.cache.memory_usage() as f64);
}
}

Expand Down Expand Up @@ -580,6 +581,8 @@ where
struct CacheMetrics {
/// The number of entities in the cache.
cached_count: Gauge,
/// The memory usage of the cache in bytes.
cached_bytes: Gauge,
/// The number of queued consumers.
queued_consumers_count: Gauge,
}

0 comments on commit 10db786

Please sign in to comment.