@@ -41,7 +41,7 @@ var evmBlockIndexedCounter = prometheus.NewCounter(prometheus.CounterOpts{
4141
4242var evmTxIndexedCounter = prometheus .NewCounter (prometheus.CounterOpts {
4343 Name : prefixedName ("txs_indexed_total" ),
44- Help : "Total number transactions indexed" ,
44+ Help : "Total number of transactions indexed" ,
4545})
4646
4747var evmAccountCallCounters = prometheus .NewCounterVec (prometheus.CounterOpts {
@@ -77,6 +77,11 @@ var requestRateLimitedCounters = prometheus.NewCounterVec(prometheus.CounterOpts
7777 Help : "Total number of rate limits by JSON-RPC method" ,
7878}, []string {"method" })
7979
80+ var transactionsDroppedCounter = prometheus .NewCounter (prometheus.CounterOpts {
81+ Name : prefixedName ("transactions_dropped_total" ),
82+ Help : "Total number of EVM transactions dropped due to service errors" ,
83+ })
84+
8085var metrics = []prometheus.Collector {
8186 apiErrors ,
8287 serverPanicsCounters ,
@@ -91,6 +96,7 @@ var metrics = []prometheus.Collector{
9196 gasEstimationIterations ,
9297 blockIngestionTime ,
9398 requestRateLimitedCounters ,
99+ transactionsDroppedCounter ,
94100}
95101
96102type Collector interface {
@@ -106,6 +112,7 @@ type Collector interface {
106112 GasEstimationIterations (count int )
107113 BlockIngestionTime (blockCreation time.Time )
108114 RequestRateLimited (method string )
115+ TransactionsDropped (count int )
109116}
110117
111118var _ Collector = & DefaultCollector {}
@@ -125,6 +132,7 @@ type DefaultCollector struct {
125132 gasEstimationIterations prometheus.Gauge
126133 blockIngestionTime prometheus.Histogram
127134 requestRateLimitedCounters * prometheus.CounterVec
135+ transactionsDroppedCounter prometheus.Counter
128136}
129137
130138func NewCollector (logger zerolog.Logger ) Collector {
@@ -147,6 +155,7 @@ func NewCollector(logger zerolog.Logger) Collector {
147155 gasEstimationIterations : gasEstimationIterations ,
148156 blockIngestionTime : blockIngestionTime ,
149157 requestRateLimitedCounters : requestRateLimitedCounters ,
158+ transactionsDroppedCounter : transactionsDroppedCounter ,
150159 }
151160}
152161
@@ -221,6 +230,10 @@ func (c *DefaultCollector) RequestRateLimited(method string) {
221230 ).Inc ()
222231}
223232
233+ func (c * DefaultCollector ) TransactionsDropped (count int ) {
234+ c .transactionsDroppedCounter .Add (float64 (count ))
235+ }
236+
224237func prefixedName (name string ) string {
225238 return fmt .Sprintf ("evm_gateway_%s" , name )
226239}
0 commit comments