Skip to content

Commit

Permalink
feat: set default values to 0 in prometheus metrics that need to be i…
Browse files Browse the repository at this point in the history
…nitialized
  • Loading branch information
saibatizoku committed Nov 1, 2023
1 parent 478cabc commit 4585475
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jormungandr/src/metrics/backends/prometheus_exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ impl Default for Prometheus {
let tx_recv_cnt = IntCounter::new("txRecvCnt", "txRecvCnt").unwrap();
registry.register(Box::new(tx_recv_cnt.clone())).unwrap();
let mempool_usage_ratio = Gauge::new("mempoolUsageRatio", "mempoolUsageRatio").unwrap();
mempool_usage_ratio.set(0f64);
registry
.register(Box::new(mempool_usage_ratio.clone()))
.unwrap();
let mempool_size_bytes_total =
UIntGauge::new("mempoolSizeBytesTotal", "mempoolSizeBytesTotal").unwrap();
mempool_size_bytes_total.set(0);
registry
.register(Box::new(mempool_size_bytes_total.clone()))
.unwrap();
Expand All @@ -99,15 +101,18 @@ impl Default for Prometheus {
let block_recv_cnt = IntCounter::new("blockRecvCnt", "blockRecvCnt").unwrap();
registry.register(Box::new(block_recv_cnt.clone())).unwrap();
let peer_connected_cnt = UIntGauge::new("peerConnectedCnt", "peerConnectedCnt").unwrap();
peer_connected_cnt.set(0);
registry
.register(Box::new(peer_connected_cnt.clone()))
.unwrap();
let peer_quarantined_cnt =
UIntGauge::new("peerQuarantinedCnt", "peerQuarantinedCnt").unwrap();
peer_quarantined_cnt.set(0);
registry
.register(Box::new(peer_quarantined_cnt.clone()))
.unwrap();
let peer_available_cnt = UIntGauge::new("peerAvailableCnt", "peerAvailableCnt").unwrap();
peer_available_cnt.set(0);
registry
.register(Box::new(peer_available_cnt.clone()))
.unwrap();
Expand Down

0 comments on commit 4585475

Please sign in to comment.