feat(worker): add a commit tx failed metric (#704)

* feat(worker): add a commit tx failed metric

* bump version

* add number of L1 messages metric
This commit is contained in:
colin 2024-04-17 18:32:00 +08:00 committed by GitHub
parent bf22663ed6
commit d81a3308b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

View file

@ -95,6 +95,7 @@ var (
l2CommitTxsTimer = metrics.NewRegisteredTimer("miner/commit/txs_all", nil)
l2CommitTxTimer = metrics.NewRegisteredTimer("miner/commit/tx_all", nil)
l2CommitTxFailedTimer = metrics.NewRegisteredTimer("miner/commit/tx_all_failed", nil)
l2CommitTxTraceTimer = metrics.NewRegisteredTimer("miner/commit/tx_trace", nil)
l2CommitTxTraceStateRevertTimer = metrics.NewRegisteredTimer("miner/commit/tx_trace_state_revert", nil)
l2CommitTxCCCTimer = metrics.NewRegisteredTimer("miner/commit/tx_ccc", nil)
@ -927,6 +928,9 @@ func (w *worker) commitTransaction(tx *types.Transaction, coinbase common.Addres
if w.isRunning() {
defer func(t0 time.Time) {
l2CommitTxTimer.Update(time.Since(t0))
if err != nil {
l2CommitTxFailedTimer.Update(time.Since(t0))
}
}(time.Now())
// do gas limit check up-front and do not run CCC if it fails

View file

@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 2 // Minor version component of the current release
VersionPatch = 3 // Patch version component of the current release
VersionPatch = 4 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

View file

@ -11,6 +11,7 @@ import (
"github.com/scroll-tech/go-ethereum/ethdb"
"github.com/scroll-tech/go-ethereum/event"
"github.com/scroll-tech/go-ethereum/log"
"github.com/scroll-tech/go-ethereum/metrics"
"github.com/scroll-tech/go-ethereum/node"
"github.com/scroll-tech/go-ethereum/params"
)
@ -35,6 +36,10 @@ const (
DbWriteThresholdBlocks = 1000
)
var (
l1MessageTotalCounter = metrics.NewRegisteredCounter("rollup/l1/message", nil)
)
// SyncService collects all L1 messages and stores them in a local database.
type SyncService struct {
ctx context.Context
@ -172,6 +177,7 @@ func (s *SyncService) fetchMessages() {
numBlocksPendingDbWrite = 0
if numMessagesPendingDbWrite > 0 {
l1MessageTotalCounter.Inc(int64(numMessagesPendingDbWrite))
s.msgCountFeed.Send(core.NewL1MsgsEvent{Count: numMessagesPendingDbWrite})
numMessagesPendingDbWrite = 0
}