This bounty is no longer available
Web3 DAO | Optimism Logo

op-service/txmgr: Transaction Manager Metrics

Organization

Optimism

Deadline

N/A

Status

ENDED


INSTRUCTIONS

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/metrics with a reusable metrics struct, so it can be embedded into the op-batcher/metrics.Metrics and op-proposer/metrics.Metrics structs.
    • In this sense, the tx mgr metrics component is more similar to the reusable op-service/metrics.RefMetrics struct. It should have a ctor similar to MakeRefMetrics so it can be embedded into both batcher and proposer metrics.
    • All individual metrics should also set the GaugeOpts.Subsystem field to "txmgr". So effectively, individual metrics should result in having names like op_batcher_default_txmgr_nonce.
    • [x] op-service/txmgr/metrics package should have an interface Metricer and the two implementations Metrics and NoopMetrics (similar to RefMetrics). The txmgr ctor should receive a Metricer .
  • [x] Embed and initialize Metrics and NoopMetrics in 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