@@ -18,17 +18,6 @@ const (
18
18
// MetricsSubsystem is a subsystem shared by all metrics exposed by this
19
19
// package.
20
20
MetricsSubsystem = "mempool"
21
-
22
- TypeLabel = "type"
23
-
24
- FailedPrecheck = "precheck"
25
- FailedAdding = "adding"
26
- FailedRecheck = "recheck"
27
-
28
- EvictedNewTxFullMempool = "full-removed-incoming"
29
- EvictedExistingTxFullMempool = "full-removed-existing"
30
- EvictedTxExpiredBlocks = "expired-ttl-blocks"
31
- EvictedTxExpiredTime = "expired-ttl-time"
32
21
)
33
22
34
23
// Metrics contains metrics exposed by this package.
@@ -49,10 +38,13 @@ type Metrics struct {
49
38
50
39
// EvictedTxs defines the number of evicted transactions. These are valid
51
40
// transactions that passed CheckTx and existed in the mempool but were later
52
- // evicted to make room for higher priority valid transactions that passed
53
- // CheckTx.
41
+ // evicted to make room for higher priority valid transactions
54
42
EvictedTxs metrics.Counter
55
43
44
+ // ExpiredTxs defines transactions that were removed from the mempool due
45
+ // to a TTL
46
+ ExpiredTxs metrics.Counter
47
+
56
48
// SuccessfulTxs defines the number of transactions that successfully made
57
49
// it into a block.
58
50
SuccessfulTxs metrics.Counter
@@ -82,7 +74,6 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
82
74
for i := 0 ; i < len (labelsAndValues ); i += 2 {
83
75
labels = append (labels , labelsAndValues [i ])
84
76
}
85
- typedCounterLabels := append (append (make ([]string , 0 , len (labels )+ 1 ), labels ... ), TypeLabel )
86
77
return & Metrics {
87
78
Size : prometheus .NewGaugeFrom (stdprometheus.GaugeOpts {
88
79
Namespace : namespace ,
@@ -111,14 +102,21 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
111
102
Subsystem : MetricsSubsystem ,
112
103
Name : "failed_txs" ,
113
104
Help : "Number of failed transactions." ,
114
- }, typedCounterLabels ).With (labelsAndValues ... ),
105
+ }, labels ).With (labelsAndValues ... ),
115
106
116
107
EvictedTxs : prometheus .NewCounterFrom (stdprometheus.CounterOpts {
117
108
Namespace : namespace ,
118
109
Subsystem : MetricsSubsystem ,
119
110
Name : "evicted_txs" ,
120
111
Help : "Number of evicted transactions." ,
121
- }, typedCounterLabels ).With (labelsAndValues ... ),
112
+ }, labels ).With (labelsAndValues ... ),
113
+
114
+ ExpiredTxs : prometheus .NewCounterFrom (stdprometheus.CounterOpts {
115
+ Namespace : namespace ,
116
+ Subsystem : MetricsSubsystem ,
117
+ Name : "expired_txs" ,
118
+ Help : "Number of expired transactions." ,
119
+ }, labels ).With (labelsAndValues ... ),
122
120
123
121
SuccessfulTxs : prometheus .NewCounterFrom (stdprometheus.CounterOpts {
124
122
Namespace : namespace ,
@@ -165,6 +163,7 @@ func NopMetrics() *Metrics {
165
163
TxSizeBytes : discard .NewHistogram (),
166
164
FailedTxs : discard .NewCounter (),
167
165
EvictedTxs : discard .NewCounter (),
166
+ ExpiredTxs : discard .NewCounter (),
168
167
SuccessfulTxs : discard .NewCounter (),
169
168
RecheckTimes : discard .NewCounter (),
170
169
AlreadySeenTxs : discard .NewCounter (),
0 commit comments