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
94ca47ec
Commit
94ca47ec
authored
Jul 18, 2023
by
Felipe Andrade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes, deployed to dev
parent
0919fb21
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
15 deletions
+35
-15
Dockerfile
op-ufm/Dockerfile
+5
-6
Makefile
op-ufm/Makefile
+21
-0
main.go
op-ufm/cmd/ufm/main.go
+0
-0
metrics.go
op-ufm/pkg/metrics/metrics.go
+3
-3
heartbeat.go
op-ufm/pkg/provider/heartbeat.go
+4
-4
roundtrip.go
op-ufm/pkg/provider/roundtrip.go
+1
-1
tx_pool.go
op-ufm/pkg/provider/tx_pool.go
+1
-1
No files found.
op-ufm/Dockerfile
View file @
94ca47ec
...
@@ -6,7 +6,7 @@ ARG GITVERSION=docker
...
@@ -6,7 +6,7 @@ ARG GITVERSION=docker
RUN
apk add make jq git gcc musl-dev linux-headers
RUN
apk add make jq git gcc musl-dev linux-headers
COPY
./ufm /app
COPY
./
op-
ufm /app
WORKDIR
/app
WORKDIR
/app
...
@@ -14,17 +14,16 @@ RUN make ufm
...
@@ -14,17 +14,16 @@ RUN make ufm
FROM
alpine:3.18
FROM
alpine:3.18
COPY
./ufm/entrypoint.sh /bin/entrypoint.sh
COPY
--from=builder /app/entrypoint.sh /bin/entrypoint.sh
COPY
--from=builder /app/bin/ufm /bin/ufm
RUN
apk update
&&
\
RUN
apk update
&&
\
apk add ca-certificates
&&
\
apk add ca-certificates
&&
\
chmod
+x /bin/entrypoint.sh
chmod
+x /bin/entrypoint.sh
EXPOSE
8080
VOLUME
/etc/ufm
VOLUME
/etc/ufm
COPY
--from=builder /app/bin/op-ufm /bin/op-ufm
EXPOSE
8080
ENTRYPOINT
["/bin/entrypoint.sh"]
ENTRYPOINT
["/bin/entrypoint.sh"]
CMD
["/bin/
op-ufm", "/etc/op-
ufm/config.toml"]
CMD
["/bin/
ufm", "/etc/
ufm/config.toml"]
op-ufm/Makefile
0 → 100644
View file @
94ca47ec
LDFLAGSSTRING
+=
-X
main.GitCommit
=
$(GITCOMMIT)
LDFLAGSSTRING
+=
-X
main.GitDate
=
$(GITDATE)
LDFLAGSSTRING
+=
-X
main.GitVersion
=
$(GITVERSION)
LDFLAGS
:=
-ldflags
"
$(LDFLAGSSTRING)
"
ufm
:
go build
-v
$(LDFLAGS)
-o
./bin/ufm ./cmd/ufm
.PHONY
:
ufm
fmt
:
go mod tidy
gofmt
-w
.
.PHONY
:
fmt
test
:
go
test
-race
-v
./...
.PHONY
:
test
lint
:
go vet ./...
.PHONY
:
test
op-ufm/cmd/main.go
→
op-ufm/cmd/
ufm/
main.go
View file @
94ca47ec
File moved
op-ufm/pkg/metrics/metrics.go
View file @
94ca47ec
...
@@ -18,10 +18,10 @@ const (
...
@@ -18,10 +18,10 @@ const (
var
(
var
(
Debug
bool
Debug
bool
errorsTotal
=
promauto
.
New
CounterVec
(
prometheus
.
Counter
Opts
{
errorsTotal
=
promauto
.
New
GaugeVec
(
prometheus
.
Gauge
Opts
{
Namespace
:
MetricsNamespace
,
Namespace
:
MetricsNamespace
,
Name
:
"errors_total"
,
Name
:
"errors_total"
,
Help
:
"Count of errors
.
"
,
Help
:
"Count of errors"
,
},
[]
string
{
},
[]
string
{
"provider"
,
"provider"
,
"error"
,
"error"
,
...
@@ -119,7 +119,7 @@ func RecordGasUsed(provider string, val uint64) {
...
@@ -119,7 +119,7 @@ func RecordGasUsed(provider string, val uint64) {
log
.
Debug
(
"metric add"
,
"m"
,
"gas_used"
,
log
.
Debug
(
"metric add"
,
"m"
,
"gas_used"
,
"provider"
,
provider
,
"val"
,
val
)
"provider"
,
provider
,
"val"
,
val
)
}
}
gasUsed
.
WithLabelValues
(
provider
)
.
Add
(
float64
(
val
))
gasUsed
.
WithLabelValues
(
provider
)
.
Set
(
float64
(
val
))
}
}
func
RecordFirstSeenLatency
(
providerSource
string
,
providerSeen
string
,
latency
time
.
Duration
)
{
func
RecordFirstSeenLatency
(
providerSource
string
,
providerSeen
string
,
latency
time
.
Duration
)
{
...
...
op-ufm/pkg/provider/heartbeat.go
View file @
94ca47ec
...
@@ -22,7 +22,7 @@ func (p *Provider) Heartbeat(ctx context.Context) {
...
@@ -22,7 +22,7 @@ func (p *Provider) Heartbeat(ctx context.Context) {
expectedTransactions
:=
make
([]
*
TransactionState
,
0
,
len
(
p
.
txPool
.
Transactions
))
expectedTransactions
:=
make
([]
*
TransactionState
,
0
,
len
(
p
.
txPool
.
Transactions
))
alreadySeen
:=
0
alreadySeen
:=
0
for
_
,
st
:=
range
p
.
txPool
.
Transactions
{
for
_
,
st
:=
range
p
.
txPool
.
Transactions
{
if
st
.
ProviderS
entTo
==
p
.
name
{
if
st
.
ProviderS
ource
==
p
.
name
{
continue
continue
}
}
if
_
,
exist
:=
st
.
SeenBy
[
p
.
name
];
exist
{
if
_
,
exist
:=
st
.
SeenBy
[
p
.
name
];
exist
{
...
@@ -59,16 +59,16 @@ func (p *Provider) Heartbeat(ctx context.Context) {
...
@@ -59,16 +59,16 @@ func (p *Provider) Heartbeat(ctx context.Context) {
latency
:=
time
.
Since
(
st
.
SentAt
)
latency
:=
time
.
Since
(
st
.
SentAt
)
if
st
.
FirstSeen
.
IsZero
()
{
if
st
.
FirstSeen
.
IsZero
()
{
st
.
FirstSeen
=
time
.
Now
()
st
.
FirstSeen
=
time
.
Now
()
metrics
.
RecordFirstSeenLatency
(
st
.
ProviderS
entTo
,
p
.
name
,
latency
)
metrics
.
RecordFirstSeenLatency
(
st
.
ProviderS
ource
,
p
.
name
,
latency
)
log
.
Info
(
"transaction first seen"
,
log
.
Info
(
"transaction first seen"
,
"hash"
,
hash
,
"hash"
,
hash
,
"firstSeenLatency"
,
latency
,
"firstSeenLatency"
,
latency
,
"providerSource"
,
st
.
ProviderS
entTo
,
"providerSource"
,
st
.
ProviderS
ource
,
"providerSeen"
,
p
.
name
)
"providerSeen"
,
p
.
name
)
}
}
if
_
,
exist
:=
st
.
SeenBy
[
p
.
name
];
!
exist
{
if
_
,
exist
:=
st
.
SeenBy
[
p
.
name
];
!
exist
{
st
.
SeenBy
[
p
.
name
]
=
time
.
Now
()
st
.
SeenBy
[
p
.
name
]
=
time
.
Now
()
metrics
.
RecordProviderToProviderLatency
(
st
.
ProviderS
entTo
,
p
.
name
,
latency
)
metrics
.
RecordProviderToProviderLatency
(
st
.
ProviderS
ource
,
p
.
name
,
latency
)
}
}
st
.
M
.
Unlock
()
st
.
M
.
Unlock
()
...
...
op-ufm/pkg/provider/roundtrip.go
View file @
94ca47ec
...
@@ -86,7 +86,7 @@ func (p *Provider) RoundTrip(ctx context.Context) {
...
@@ -86,7 +86,7 @@ func (p *Provider) RoundTrip(ctx context.Context) {
p
.
txPool
.
M
.
Lock
()
p
.
txPool
.
M
.
Lock
()
p
.
txPool
.
Transactions
[
txHash
.
Hex
()]
=
&
TransactionState
{
p
.
txPool
.
Transactions
[
txHash
.
Hex
()]
=
&
TransactionState
{
Hash
:
txHash
,
Hash
:
txHash
,
ProviderS
entTo
:
p
.
name
,
ProviderS
ource
:
p
.
name
,
SentAt
:
sentAt
,
SentAt
:
sentAt
,
SeenBy
:
make
(
map
[
string
]
time
.
Time
),
SeenBy
:
make
(
map
[
string
]
time
.
Time
),
}
}
...
...
op-ufm/pkg/provider/tx_pool.go
View file @
94ca47ec
...
@@ -25,7 +25,7 @@ type TransactionState struct {
...
@@ -25,7 +25,7 @@ type TransactionState struct {
M
sync
.
Mutex
M
sync
.
Mutex
SentAt
time
.
Time
SentAt
time
.
Time
ProviderS
entTo
string
ProviderS
ource
string
FirstSeen
time
.
Time
FirstSeen
time
.
Time
...
...
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