-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from andyzhang2023/impr/add-some-metrics-txpool
Impr/add some metrics txpool
- Loading branch information
Showing
4 changed files
with
120 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package txpool | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/metrics" | ||
) | ||
|
||
const ( | ||
AlreadyKnown = "AlreadyKnown" | ||
TypeNotSupportDeposit = "TypeNotSupportDeposit" | ||
TypeNotSupport1559 = "TypeNotSupport1559" | ||
TypeNotSupport2718 = "TypeNotSupport2718" | ||
MissingTransaction = "MissingTransaction" | ||
OversizedData = "OversizedData" | ||
MaxInitCodeSizeExceeded = "MaxInitCodeSizeExceeded" | ||
NegativeValue = "NegativeValue" | ||
GasLimit = "GasLimit" | ||
FeeCapVeryHigh = "FeeCapVeryHigh" | ||
TipVeryHigh = "TipVeryHigh" | ||
TipAboveFeeCap = "TipAboveFeeCap" | ||
InvalidSender = "InvalidSender" | ||
Underpriced = "Underpriced" | ||
NonceTooLow = "NonceTooLow" | ||
InsufficientFunds = "InsufficientFunds" | ||
Overdraft = "Overdraft" | ||
IntrinsicGas = "IntrinsicGas" | ||
Throttle = "Throttle" | ||
Overflow = "Overflow" | ||
FutureReplacePending = "FutureReplacePending" | ||
ReplaceUnderpriced = "ReplaceUnderpriced" | ||
QueuedDiscard = "QueueDiscard" | ||
GasUnitOverflow = "GasUnitOverflow" | ||
) | ||
|
||
func meter(err string) metrics.Meter { | ||
return metrics.GetOrRegisterMeter("txpool/invalid/"+err, nil) | ||
} | ||
|
||
func init() { | ||
// init the metrics | ||
for _, err := range []string{ | ||
AlreadyKnown, | ||
TypeNotSupportDeposit, | ||
TypeNotSupport1559, | ||
TypeNotSupport2718, | ||
MissingTransaction, | ||
OversizedData, | ||
MaxInitCodeSizeExceeded, | ||
NegativeValue, | ||
GasLimit, | ||
FeeCapVeryHigh, | ||
TipVeryHigh, | ||
TipAboveFeeCap, | ||
InvalidSender, | ||
Underpriced, | ||
NonceTooLow, | ||
InsufficientFunds, | ||
Overdraft, | ||
IntrinsicGas, | ||
Throttle, | ||
Overflow, | ||
FutureReplacePending, | ||
ReplaceUnderpriced, | ||
QueuedDiscard, | ||
GasUnitOverflow, | ||
} { | ||
meter(err).Mark(0) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters