Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
cdf3a602
Unverified
Commit
cdf3a602
authored
Aug 19, 2024
by
Sebastian Stammler
Committed by
GitHub
Aug 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
txmgr: add tx-type metric (#11523)
parent
116b6e62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
14 deletions
+22
-14
tx_metrics.go
op-service/txmgr/metrics/tx_metrics.go
+22
-14
No files found.
op-service/txmgr/metrics/tx_metrics.go
View file @
cdf3a602
...
...
@@ -24,11 +24,12 @@ type TxMetricer interface {
}
type
TxMetrics
struct
{
T
xL1GasFee
prometheus
.
Gauge
txFees
prometheus
.
Counter
T
xGasBump
prometheus
.
Gauge
t
xL1GasFee
prometheus
.
Gauge
txFees
Total
prometheus
.
Counter
t
xGasBump
prometheus
.
Gauge
txFeeHistogram
prometheus
.
Histogram
LatencyConfirmedTx
prometheus
.
Gauge
txType
prometheus
.
Gauge
latencyConfirmedTx
prometheus
.
Gauge
currentNonce
prometheus
.
Gauge
pendingTxs
prometheus
.
Gauge
txPublishError
*
prometheus
.
CounterVec
...
...
@@ -55,18 +56,24 @@ var _ TxMetricer = (*TxMetrics)(nil)
func
MakeTxMetrics
(
ns
string
,
factory
metrics
.
Factory
)
TxMetrics
{
return
TxMetrics
{
T
xL1GasFee
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
t
xL1GasFee
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
Namespace
:
ns
,
Name
:
"tx_fee_gwei"
,
Help
:
"L1 gas fee for transactions in GWEI"
,
Subsystem
:
"txmgr"
,
}),
txFees
:
factory
.
NewCounter
(
prometheus
.
CounterOpts
{
txFees
Total
:
factory
.
NewCounter
(
prometheus
.
CounterOpts
{
Namespace
:
ns
,
Name
:
"tx_fee_gwei_total"
,
Help
:
"Sum of fees spent for all transactions in GWEI"
,
Subsystem
:
"txmgr"
,
}),
txGasBump
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
Namespace
:
ns
,
Name
:
"tx_gas_bump"
,
Help
:
"Number of times a transaction gas needed to be bumped before it got included"
,
Subsystem
:
"txmgr"
,
}),
txFeeHistogram
:
factory
.
NewHistogram
(
prometheus
.
HistogramOpts
{
Namespace
:
ns
,
Name
:
"tx_fee_histogram_gwei"
,
...
...
@@ -74,13 +81,13 @@ func MakeTxMetrics(ns string, factory metrics.Factory) TxMetrics {
Subsystem
:
"txmgr"
,
Buckets
:
[]
float64
{
0.5
,
1
,
2
,
5
,
10
,
20
,
40
,
60
,
80
,
100
,
200
,
400
,
800
,
1600
},
}),
TxGasBump
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
txType
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
Namespace
:
ns
,
Name
:
"tx_
gas_bump
"
,
Help
:
"
Number of times a transaction gas needed to be bumped before it got included
"
,
Name
:
"tx_
type
"
,
Help
:
"
Transaction type (receipt field uint8)
"
,
Subsystem
:
"txmgr"
,
}),
L
atencyConfirmedTx
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
l
atencyConfirmedTx
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
Namespace
:
ns
,
Name
:
"tx_confirmed_latency_ms"
,
Help
:
"Latency of a confirmed transaction in milliseconds"
,
...
...
@@ -145,17 +152,18 @@ func (t *TxMetrics) RecordPendingTx(pending int64) {
func
(
t
*
TxMetrics
)
TxConfirmed
(
receipt
*
types
.
Receipt
)
{
fee
:=
float64
(
receipt
.
EffectiveGasPrice
.
Uint64
()
*
receipt
.
GasUsed
/
params
.
GWei
)
t
.
confirmEvent
.
Record
(
receiptStatusString
(
receipt
))
t
.
T
xL1GasFee
.
Set
(
fee
)
t
.
txFees
.
Add
(
fee
)
t
.
t
xL1GasFee
.
Set
(
fee
)
t
.
txFees
Total
.
Add
(
fee
)
t
.
txFeeHistogram
.
Observe
(
fee
)
t
.
txType
.
Set
(
float64
(
receipt
.
Type
))
}
func
(
t
*
TxMetrics
)
RecordGasBumpCount
(
times
int
)
{
t
.
T
xGasBump
.
Set
(
float64
(
times
))
t
.
t
xGasBump
.
Set
(
float64
(
times
))
}
func
(
t
*
TxMetrics
)
RecordTxConfirmationLatency
(
latency
int64
)
{
t
.
L
atencyConfirmedTx
.
Set
(
float64
(
latency
))
t
.
l
atencyConfirmedTx
.
Set
(
float64
(
latency
))
}
func
(
t
*
TxMetrics
)
TxPublished
(
errString
string
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment