Context
The transaction manager op-service/txmgr is shared between the op-batcher and op-proposer. So adding metrics to the txmgr automatically benefits both services.
Description
Architecture
- [x] Create new package
op-service/txmgr/metricswith a reusable metrics struct, so it can be embedded into theop-batcher/metrics.Metricsandop-proposer/metrics.Metricsstructs.- In this sense, the tx mgr metrics component is more similar to the reusable
op-service/metrics.RefMetricsstruct. It should have a ctor similar toMakeRefMetricsso it can be embedded into both batcher and proposer metrics. - All individual metrics should also set the
GaugeOpts.Subsystemfield to"txmgr". So effectively, individual metrics should result in having names likeop_batcher_default_txmgr_nonce. - [x]
op-service/txmgr/metricspackage should have an interfaceMetricerand the two implementationsMetricsandNoopMetrics(similar toRefMetrics). The txmgr ctor should receive aMetricer.
- In this sense, the tx mgr metrics component is more similar to the reusable
- [x] Embed and initialize
MetricsandNoopMetricsin the respective batcher and proposer metrics - [x] Move balance metrics from batcher & proposer into the tx-manager metrics
List of Metrics
- [x] Gauge & Histogram of confirmation latency (likely seconds, from when tx was first sent to when it was included on chain).
- Can also have from when the final bumped price one was submitted to when that one got included.
- [x] Counter/Histogram of the number of times it bumped a tx after it sent the one that got included.
- [x] Gauge of send state errors (pre-populated list of errors + bucket for unknown)
- [x] Gauge/Histogram of how many times it had to bump the TX price
- [x] Gauge for current nonce
- [ ] Counter of gas / fees spent on L1
- [ ] Histogram of gas / fees spent on L1 (maybe more interesting in the batcher)
- [ ] Gauge/Histogram of basefee/tip for submitting transactions
These metrics can be added incrementally with multiple PRs.
Testing
You can test your new metrics locally by spinning up a devnet with make devnet-up and then watching http://localhost:7300/. Check that all the new txmgr metrics are there and show sensible values.
Fixes CLI-3319
