Skip to content

Commit

Permalink
[R4R]-{develop}-[gasoracle]impr: modify token_ratio from int64 to flo…
Browse files Browse the repository at this point in the history
…at64 for metrics
  • Loading branch information
Tri-stone committed Jul 21, 2023
1 parent ba9a7f7 commit eac5341
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gas-oracle/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (

// metrics for L1 base fee, L1 bas price, da fee
// TokenRatioGauge token_ratio = eth_price / mnt_price
TokenRatioGauge metrics.Gauge
TokenRatioGauge metrics.GaugeFloat64
// L1BaseFeeGauge (l1_base_fee + l1_priority_fee) * token_ratio
L1BaseFeeGauge metrics.Gauge
// FeeScalarGauge value to scale the fee up by
Expand Down Expand Up @@ -44,7 +44,7 @@ func InitAndRegisterStats(r metrics.Registry) {
GasOracleStats.TxSendTimer = metrics.NewRegisteredTimer("tx/send", r)

// stats for L1 base fee, L1 bas price, da fee
GasOracleStats.TokenRatioGauge = metrics.NewRegisteredGauge("token_ratio", r)
GasOracleStats.TokenRatioGauge = metrics.NewRegisteredGaugeFloat64("token_ratio", r)
GasOracleStats.L1BaseFeeGauge = metrics.NewRegisteredGauge("l1_base_fee", r)
GasOracleStats.FeeScalarGauge = metrics.NewRegisteredGauge("fee_scalar", r)
GasOracleStats.DaFeeGauge = metrics.NewRegisteredGauge("da_fee", r)
Expand Down
2 changes: 1 addition & 1 deletion gas-oracle/oracle/l1_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *L1Client) HeaderByNumber(ctx context.Context, number *big.Int) (*types.
tip.BaseFee = new(big.Int).Mul(new(big.Int).Add(bestBaseFee, gasTipCap), big.NewInt(int64(ratio)))
log.Info("show base fee context", "bestBaseFee", bestBaseFee, "gasTipCap", gasTipCap, "ratio", ratio)
ometrics.GasOracleStats.L1GasPriceGauge.Update(new(big.Int).Add(bestBaseFee, gasTipCap).Int64())
ometrics.GasOracleStats.TokenRatioGauge.Update(int64(ratio))
ometrics.GasOracleStats.TokenRatioGauge.Update(ratio)
return tip, nil
}

Expand Down

0 comments on commit eac5341

Please sign in to comment.