Skip to content

DF-21989: OCR2 transmit outcome metrics (TXM v1/v2)#398

Draft
cl-efornaciari wants to merge 3 commits intosmartcontractkit:developfrom
cl-efornaciari:feature/DF-21989/ocr2-transmit-metrics
Draft

DF-21989: OCR2 transmit outcome metrics (TXM v1/v2)#398
cl-efornaciari wants to merge 3 commits intosmartcontractkit:developfrom
cl-efornaciari:feature/DF-21989/ocr2-transmit-metrics

Conversation

@cl-efornaciari
Copy link
Contributor

@cl-efornaciari cl-efornaciari commented Mar 24, 2026

Summary

Adds Prometheus metrics for OCR2 aggregator transmit transactions to support DF-21989 (duplicate PMAIs DF-22761 / DF-22643).

Changes

  • New pkg/ocr2transmit: detect OCR2 transmit calldata; shared counters ocr2_transmit_tx_{confirmed,reverted,fatal}_total and gauge ocr2_transmit_unconfirmed_tx_count.
  • TXM v1: record outcomes in finalizer when receipts are processed or txs expire without receipt.
  • TXM v2: record confirmed on nonce-based confirmation; fatal on MarkTxFatal; refresh unconfirmed OCR2-shaped tx gauge after backfill.

Notes

  • Branch pushed from fork (unsigned) due to upstream commit signing rules; maintainers may merge via signed cherry-pick or ask for a signed push from a maintainer machine.

Made with Cursor

Comment on lines +12 to +27
promTransmitConfirmed = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "ocr2_transmit_tx_confirmed_total",
Help: "OCR2 aggregator transmit transactions that received a successful on-chain receipt.",
}, []string{"chain_id", "contract_address", "from_address"})
promTransmitReverted = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "ocr2_transmit_tx_reverted_total",
Help: "OCR2 aggregator transmit transactions that were included but reverted.",
}, []string{"chain_id", "contract_address", "from_address"})
promTransmitFatal = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "ocr2_transmit_tx_fatal_total",
Help: "OCR2 aggregator transmit transactions marked fatally errored by TXM (e.g. could not get receipt).",
}, []string{"chain_id", "contract_address", "from_address"})
promTransmitUnconfirmed = promauto.NewGaugeVec(prometheus.GaugeOpts{
Name: "ocr2_transmit_unconfirmed_tx_count",
Help: "Count of unconfirmed in-memory transactions whose calldata is an OCR2 transmit call (TXM v2 per from_address).",
}, []string{"chain_id", "from_address"})
Copy link
Contributor

@cll-gg cll-gg Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use otel metrics instead of (or next to) prom metrics, then they will be ingested by Beholder and NOP metrics will be visible in Grafana

Record confirmed/reverted/fatal counters and unconfirmed gauge via
beholder alongside Prometheus; pass context into RecordOutcome (DF-21989).
@cl-efornaciari cl-efornaciari force-pushed the feature/DF-21989/ocr2-transmit-metrics branch from 5ddb738 to c8651a4 Compare March 25, 2026 23:30
ocr2TransmitOtelOnce.Do(func() {
m := beholder.GetMeter()
confirmed, err := m.Int64Counter("ocr2_transmit_tx_confirmed_total")
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we at least print the error? Now it's getting swallowed

Singleton process metrics with methods RecordOutcome and SetUnconfirmedGauge;
package functions delegate for unchanged call sites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants