Commit 16ecca2f authored by Hamdi Allam's avatar Hamdi Allam

preserve existing metric names for proven/finalized withdrawals

parent 037ec87d
...@@ -60,7 +60,9 @@ type bridgeMetrics struct { ...@@ -60,7 +60,9 @@ type bridgeMetrics struct {
intervalFailures *prometheus.CounterVec intervalFailures *prometheus.CounterVec
txDeposits prometheus.Counter txDeposits prometheus.Counter
txWithdrawals *prometheus.CounterVec txWithdrawals prometheus.Counter
provenWithdrawals prometheus.Counter
finalizedWithdrawals prometheus.Counter
txMintedETH prometheus.Counter txMintedETH prometheus.Counter
txWithdrawnETH prometheus.Counter txWithdrawnETH prometheus.Counter
...@@ -117,18 +119,26 @@ func NewMetrics(registry *prometheus.Registry) Metricer { ...@@ -117,18 +119,26 @@ func NewMetrics(registry *prometheus.Registry) Metricer {
Name: "tx_minted_eth", Name: "tx_minted_eth",
Help: "amount of eth bridged from l1", Help: "amount of eth bridged from l1",
}), }),
txWithdrawals: factory.NewCounterVec(prometheus.CounterOpts{ txWithdrawals: factory.NewCounter(prometheus.CounterOpts{
Namespace: MetricsNamespace, Namespace: MetricsNamespace,
Name: "tx_withdrawals", Name: "tx_withdrawals",
Help: "number of processed transactions withdrawals (initiated|proven|finalized)", Help: "number of initiated transaction withdrawals from l2",
}, []string{
"stage",
}), }),
txWithdrawnETH: factory.NewCounter(prometheus.CounterOpts{ txWithdrawnETH: factory.NewCounter(prometheus.CounterOpts{
Namespace: MetricsNamespace, Namespace: MetricsNamespace,
Name: "tx_withdrawn_eth", Name: "tx_withdrawn_eth",
Help: "amount of eth withdrawn from l2", Help: "amount of eth withdrawn from l2",
}), }),
provenWithdrawals: factory.NewCounter(prometheus.CounterOpts{
Namespace: MetricsNamespace,
Name: "proven_withdrawals",
Help: "number of proven tx withdrawals on l1",
}),
finalizedWithdrawals: factory.NewCounter(prometheus.CounterOpts{
Namespace: MetricsNamespace,
Name: "finalized_withdrawals",
Help: "number of finalized tx withdrawals on l1",
}),
sentMessages: factory.NewCounterVec(prometheus.CounterOpts{ sentMessages: factory.NewCounterVec(prometheus.CounterOpts{
Namespace: MetricsNamespace, Namespace: MetricsNamespace,
Name: "sent_messages", Name: "sent_messages",
...@@ -201,11 +211,11 @@ func (m *bridgeMetrics) RecordL1TransactionDeposits(size int, mintedETH float64) ...@@ -201,11 +211,11 @@ func (m *bridgeMetrics) RecordL1TransactionDeposits(size int, mintedETH float64)
} }
func (m *bridgeMetrics) RecordL1ProvenWithdrawals(size int) { func (m *bridgeMetrics) RecordL1ProvenWithdrawals(size int) {
m.txWithdrawals.WithLabelValues("stage", "proven").Add(float64(size)) m.provenWithdrawals.Add(float64(size))
} }
func (m *bridgeMetrics) RecordL1FinalizedWithdrawals(size int) { func (m *bridgeMetrics) RecordL1FinalizedWithdrawals(size int) {
m.txWithdrawals.WithLabelValues("stage", "finalized").Add(float64(size)) m.finalizedWithdrawals.Add(float64(size))
} }
func (m *bridgeMetrics) RecordL1CrossDomainSentMessages(size int) { func (m *bridgeMetrics) RecordL1CrossDomainSentMessages(size int) {
...@@ -258,7 +268,7 @@ func (m *bridgeMetrics) RecordL2LatestFinalizedHeight(height *big.Int) { ...@@ -258,7 +268,7 @@ func (m *bridgeMetrics) RecordL2LatestFinalizedHeight(height *big.Int) {
} }
func (m *bridgeMetrics) RecordL2TransactionWithdrawals(size int, withdrawnETH float64) { func (m *bridgeMetrics) RecordL2TransactionWithdrawals(size int, withdrawnETH float64) {
m.txWithdrawals.WithLabelValues("stage", "initiated").Add(float64(size)) m.txWithdrawals.Add(float64(size))
m.txWithdrawnETH.Add(withdrawnETH) m.txWithdrawnETH.Add(withdrawnETH)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment