@@ -19,22 +19,24 @@ type Collector interface {
19
19
MeasureRequestDuration (start time.Time , method string )
20
20
OperatorBalance (account * flow.Account )
21
21
AvailableSigningKeys (count int )
22
+ GasEstimationIterations (count int )
22
23
}
23
24
24
25
var _ Collector = & DefaultCollector {}
25
26
26
27
type DefaultCollector struct {
27
28
// TODO: for now we cannot differentiate which api request failed number of times
28
- apiErrorsCounter prometheus.Counter
29
- serverPanicsCounters * prometheus.CounterVec
30
- cadenceBlockHeight prometheus.Gauge
31
- evmBlockHeight prometheus.Gauge
32
- evmBlockIndexedCounter prometheus.Counter
33
- evmTxIndexedCounter prometheus.Counter
34
- operatorBalance prometheus.Gauge
35
- evmAccountCallCounters * prometheus.CounterVec
36
- requestDurations * prometheus.HistogramVec
37
- availableSigningkeys prometheus.Gauge
29
+ apiErrorsCounter prometheus.Counter
30
+ serverPanicsCounters * prometheus.CounterVec
31
+ cadenceBlockHeight prometheus.Gauge
32
+ evmBlockHeight prometheus.Gauge
33
+ evmBlockIndexedCounter prometheus.Counter
34
+ evmTxIndexedCounter prometheus.Counter
35
+ operatorBalance prometheus.Gauge
36
+ evmAccountCallCounters * prometheus.CounterVec
37
+ requestDurations * prometheus.HistogramVec
38
+ availableSigningkeys prometheus.Gauge
39
+ gasEstimationIterations prometheus.Gauge
38
40
}
39
41
40
42
func NewCollector (logger zerolog.Logger ) Collector {
@@ -90,6 +92,11 @@ func NewCollector(logger zerolog.Logger) Collector {
90
92
Help : "Number of keys available for transaction signing" ,
91
93
})
92
94
95
+ gasEstimationIterations := prometheus .NewGauge (prometheus.GaugeOpts {
96
+ Name : prefixedName ("gas_estimation_iterations" ),
97
+ Help : "Number of iterations taken to estimate the gas of a EVM call/tx" ,
98
+ })
99
+
93
100
metrics := []prometheus.Collector {
94
101
apiErrors ,
95
102
serverPanicsCounters ,
@@ -101,23 +108,25 @@ func NewCollector(logger zerolog.Logger) Collector {
101
108
evmAccountCallCounters ,
102
109
requestDurations ,
103
110
availableSigningKeys ,
111
+ gasEstimationIterations ,
104
112
}
105
113
if err := registerMetrics (logger , metrics ... ); err != nil {
106
114
logger .Info ().Msg ("using noop collector as metric register failed" )
107
115
return NopCollector
108
116
}
109
117
110
118
return & DefaultCollector {
111
- apiErrorsCounter : apiErrors ,
112
- serverPanicsCounters : serverPanicsCounters ,
113
- cadenceBlockHeight : cadenceBlockHeight ,
114
- evmBlockHeight : evmBlockHeight ,
115
- evmBlockIndexedCounter : evmBlockIndexedCounter ,
116
- evmTxIndexedCounter : evmTxIndexedCounter ,
117
- evmAccountCallCounters : evmAccountCallCounters ,
118
- requestDurations : requestDurations ,
119
- operatorBalance : operatorBalance ,
120
- availableSigningkeys : availableSigningKeys ,
119
+ apiErrorsCounter : apiErrors ,
120
+ serverPanicsCounters : serverPanicsCounters ,
121
+ cadenceBlockHeight : cadenceBlockHeight ,
122
+ evmBlockHeight : evmBlockHeight ,
123
+ evmBlockIndexedCounter : evmBlockIndexedCounter ,
124
+ evmTxIndexedCounter : evmTxIndexedCounter ,
125
+ evmAccountCallCounters : evmAccountCallCounters ,
126
+ requestDurations : requestDurations ,
127
+ operatorBalance : operatorBalance ,
128
+ availableSigningkeys : availableSigningKeys ,
129
+ gasEstimationIterations : gasEstimationIterations ,
121
130
}
122
131
}
123
132
@@ -172,6 +181,10 @@ func (c *DefaultCollector) AvailableSigningKeys(count int) {
172
181
c .availableSigningkeys .Set (float64 (count ))
173
182
}
174
183
184
+ func (c * DefaultCollector ) GasEstimationIterations (count int ) {
185
+ c .gasEstimationIterations .Set (float64 (count ))
186
+ }
187
+
175
188
func prefixedName (name string ) string {
176
189
return fmt .Sprintf ("evm_gateway_%s" , name )
177
190
}
0 commit comments