Skip to content

Commit

Permalink
feat: add metric to track current cbt ratio (matter-labs#3020)
Browse files Browse the repository at this point in the history
Add a new metric to track custom base token to ETH ratio
  • Loading branch information
ischasny authored Oct 7, 2024
1 parent eeb1c2a commit 3fd2fb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ impl BaseTokenRatioPersister {
result: OperationResult::Success,
}]
.observe(start_time.elapsed());
METRICS
.ratio
.set((ratio.numerator.get() as f64) / (ratio.denominator.get() as f64));
return Ok(ratio);
}
Err(err) => {
Expand Down
1 change: 1 addition & 0 deletions core/node/base_token_adjuster/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub(crate) struct OperationResultLabels {
#[metrics(prefix = "base_token_adjuster")]
pub(crate) struct BaseTokenAdjusterMetrics {
pub l1_gas_used: Gauge<u64>,
pub ratio: Gauge<f64>,
#[metrics(buckets = Buckets::LATENCIES)]
pub external_price_api_latency: Family<OperationResultLabels, Histogram<Duration>>,
#[metrics(buckets = Buckets::LATENCIES)]
Expand Down

0 comments on commit 3fd2fb1

Please sign in to comment.