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
773f99be
Unverified
Commit
773f99be
authored
Apr 04, 2023
by
mergify[bot]
Committed by
GitHub
Apr 04, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into aj/refactor-engine-api
parents
36c25d35
b424c7c3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
+33
-2
noop.go
op-service/txmgr/metrics/noop.go
+3
-1
tx_metrics.go
op-service/txmgr/metrics/tx_metrics.go
+25
-1
txmgr.go
op-service/txmgr/txmgr.go
+5
-0
No files found.
op-service/txmgr/metrics/noop.go
View file @
773f99be
...
...
@@ -5,3 +5,5 @@ import "github.com/ethereum/go-ethereum/core/types"
type
NoopTxMetrics
struct
{}
func
(
*
NoopTxMetrics
)
RecordL1GasFee
(
*
types
.
Receipt
)
{}
func
(
*
NoopTxMetrics
)
RecordGasBumpCount
(
int
)
{}
func
(
*
NoopTxMetrics
)
RecordTxConfirmationLatency
(
int64
)
{}
op-service/txmgr/metrics/tx_metrics.go
View file @
773f99be
...
...
@@ -10,10 +10,14 @@ import (
type
TxMetricer
interface
{
RecordL1GasFee
(
receipt
*
types
.
Receipt
)
RecordGasBumpCount
(
times
int
)
RecordTxConfirmationLatency
(
latency
int64
)
}
type
TxMetrics
struct
{
TxL1GasFee
prometheus
.
Gauge
TxGasBump
prometheus
.
Gauge
LatencyConfirmedTx
prometheus
.
Gauge
}
var
_
TxMetricer
=
(
*
TxMetrics
)(
nil
)
...
...
@@ -26,9 +30,29 @@ func MakeTxMetrics(ns string, factory metrics.Factory) TxMetrics {
Help
:
"L1 gas fee for 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"
,
}),
LatencyConfirmedTx
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
Namespace
:
ns
,
Name
:
"tx_confirmed_latency_ms"
,
Help
:
"Latency of a confirmed transaction in milliseconds"
,
Subsystem
:
"txmgr"
,
}),
}
}
func
(
t
*
TxMetrics
)
RecordL1GasFee
(
receipt
*
types
.
Receipt
)
{
t
.
TxL1GasFee
.
Set
(
float64
(
receipt
.
EffectiveGasPrice
.
Uint64
()
*
receipt
.
GasUsed
/
params
.
GWei
))
}
func
(
t
*
TxMetrics
)
RecordGasBumpCount
(
times
int
)
{
t
.
TxGasBump
.
Set
(
float64
(
times
))
}
func
(
t
*
TxMetrics
)
RecordTxConfirmationLatency
(
latency
int64
)
{
t
.
LatencyConfirmedTx
.
Set
(
float64
(
latency
))
}
op-service/txmgr/txmgr.go
View file @
773f99be
...
...
@@ -216,6 +216,7 @@ func (m *SimpleTxManager) send(ctx context.Context, tx *types.Transaction) (*typ
ticker
:=
time
.
NewTicker
(
m
.
cfg
.
ResubmissionTimeout
)
defer
ticker
.
Stop
()
bumpCounter
:=
0
for
{
select
{
case
<-
ticker
.
C
:
...
...
@@ -231,12 +232,14 @@ func (m *SimpleTxManager) send(ctx context.Context, tx *types.Transaction) (*typ
// Increase the gas price & submit the new transaction
tx
=
m
.
increaseGasPrice
(
ctx
,
tx
)
wg
.
Add
(
1
)
bumpCounter
+=
1
go
sendTxAsync
(
tx
)
case
<-
ctx
.
Done
()
:
return
nil
,
ctx
.
Err
()
case
receipt
:=
<-
receiptChan
:
m
.
metr
.
RecordGasBumpCount
(
bumpCounter
)
return
receipt
,
nil
}
}
...
...
@@ -251,6 +254,7 @@ func (m *SimpleTxManager) publishAndWaitForTx(ctx context.Context, tx *types.Tra
cCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
m
.
cfg
.
NetworkTimeout
)
defer
cancel
()
t
:=
time
.
Now
()
err
:=
m
.
backend
.
SendTransaction
(
cCtx
,
tx
)
sendState
.
ProcessSendError
(
err
)
...
...
@@ -282,6 +286,7 @@ func (m *SimpleTxManager) publishAndWaitForTx(ctx context.Context, tx *types.Tra
}
select
{
case
receiptChan
<-
receipt
:
m
.
metr
.
RecordTxConfirmationLatency
(
time
.
Since
(
t
)
.
Milliseconds
())
m
.
metr
.
RecordL1GasFee
(
receipt
)
default
:
}
...
...
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