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
01af4459
Commit
01af4459
authored
Sep 30, 2023
by
Seungju Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: use a single metrics instantiation instead of handling it per component
parent
9c4ff1e7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
19 deletions
+8
-19
batch_submitter.go
op-batcher/batcher/batch_submitter.go
+1
-3
metrics.go
op-batcher/metrics/metrics.go
+2
-0
metrics.go
op-node/metrics/metrics.go
+2
-2
rpc_metrics.go
op-service/metrics/rpc_metrics.go
+3
-14
No files found.
op-batcher/batcher/batch_submitter.go
View file @
01af4459
...
@@ -12,7 +12,6 @@ import (
...
@@ -12,7 +12,6 @@ import (
"github.com/ethereum-optimism/optimism/op-batcher/rpc"
"github.com/ethereum-optimism/optimism/op-batcher/rpc"
opservice
"github.com/ethereum-optimism/optimism/op-service"
opservice
"github.com/ethereum-optimism/optimism/op-service"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
oplog
"github.com/ethereum-optimism/optimism/op-service/log"
opmetrics
"github.com/ethereum-optimism/optimism/op-service/metrics"
"github.com/ethereum-optimism/optimism/op-service/opio"
"github.com/ethereum-optimism/optimism/op-service/opio"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oppprof
"github.com/ethereum-optimism/optimism/op-service/pprof"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
oprpc
"github.com/ethereum-optimism/optimism/op-service/rpc"
...
@@ -83,8 +82,7 @@ func Main(version string, cliCtx *cli.Context) error {
...
@@ -83,8 +82,7 @@ func Main(version string, cliCtx *cli.Context) error {
oprpc
.
WithLogger
(
l
),
oprpc
.
WithLogger
(
l
),
)
)
if
cfg
.
RPCFlag
.
EnableAdmin
{
if
cfg
.
RPCFlag
.
EnableAdmin
{
rpcMetrics
:=
opmetrics
.
NewRPCMetrics
(
procName
,
metrics
.
Namespace
)
adminAPI
:=
rpc
.
NewAdminAPI
(
batchSubmitter
,
&
m
.
RPCMetrics
,
l
)
adminAPI
:=
rpc
.
NewAdminAPI
(
batchSubmitter
,
rpcMetrics
,
l
)
server
.
AddAPI
(
rpc
.
GetAdminAPI
(
adminAPI
))
server
.
AddAPI
(
rpc
.
GetAdminAPI
(
adminAPI
))
l
.
Info
(
"Admin RPC enabled"
)
l
.
Info
(
"Admin RPC enabled"
)
}
}
...
...
op-batcher/metrics/metrics.go
View file @
01af4459
...
@@ -51,6 +51,7 @@ type Metrics struct {
...
@@ -51,6 +51,7 @@ type Metrics struct {
opmetrics
.
RefMetrics
opmetrics
.
RefMetrics
txmetrics
.
TxMetrics
txmetrics
.
TxMetrics
opmetrics
.
RPCMetrics
info
prometheus
.
GaugeVec
info
prometheus
.
GaugeVec
up
prometheus
.
Gauge
up
prometheus
.
Gauge
...
@@ -93,6 +94,7 @@ func NewMetrics(procName string) *Metrics {
...
@@ -93,6 +94,7 @@ func NewMetrics(procName string) *Metrics {
RefMetrics
:
opmetrics
.
MakeRefMetrics
(
ns
,
factory
),
RefMetrics
:
opmetrics
.
MakeRefMetrics
(
ns
,
factory
),
TxMetrics
:
txmetrics
.
MakeTxMetrics
(
ns
,
factory
),
TxMetrics
:
txmetrics
.
MakeTxMetrics
(
ns
,
factory
),
RPCMetrics
:
opmetrics
.
MakeRPCMetrics
(
ns
,
factory
),
info
:
*
factory
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
info
:
*
factory
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
Namespace
:
ns
,
Namespace
:
ns
,
...
...
op-node/metrics/metrics.go
View file @
01af4459
...
@@ -80,7 +80,7 @@ type Metrics struct {
...
@@ -80,7 +80,7 @@ type Metrics struct {
Info
*
prometheus
.
GaugeVec
Info
*
prometheus
.
GaugeVec
Up
prometheus
.
Gauge
Up
prometheus
.
Gauge
*
metrics
.
RPCMetrics
metrics
.
RPCMetrics
L1SourceCache
*
CacheMetrics
L1SourceCache
*
CacheMetrics
L2SourceCache
*
CacheMetrics
L2SourceCache
*
CacheMetrics
...
@@ -175,7 +175,7 @@ func NewMetrics(procName string) *Metrics {
...
@@ -175,7 +175,7 @@ func NewMetrics(procName string) *Metrics {
Help
:
"1 if the op node has finished starting up"
,
Help
:
"1 if the op node has finished starting up"
,
}),
}),
RPCMetrics
:
metrics
.
NewRPCMetrics
(
procName
,
Namespace
),
RPCMetrics
:
metrics
.
MakeRPCMetrics
(
ns
,
factory
),
L1SourceCache
:
NewCacheMetrics
(
factory
,
ns
,
"l1_source_cache"
,
"L1 Source cache"
),
L1SourceCache
:
NewCacheMetrics
(
factory
,
ns
,
"l1_source_cache"
,
"L1 Source cache"
),
L2SourceCache
:
NewCacheMetrics
(
factory
,
ns
,
"l2_source_cache"
,
"L2 Source cache"
),
L2SourceCache
:
NewCacheMetrics
(
factory
,
ns
,
"l2_source_cache"
,
"L2 Source cache"
),
...
...
op-service/metrics/rpc_metrics.go
View file @
01af4459
...
@@ -7,7 +7,6 @@ import (
...
@@ -7,7 +7,6 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
)
)
const
(
const
(
...
@@ -30,20 +29,10 @@ type RPCMetrics struct {
...
@@ -30,20 +29,10 @@ type RPCMetrics struct {
RPCClientResponsesTotal
*
prometheus
.
CounterVec
RPCClientResponsesTotal
*
prometheus
.
CounterVec
}
}
//
New
RPCMetrics creates a new RPCMetrics instance with the given process name, and
//
Make
RPCMetrics creates a new RPCMetrics instance with the given process name, and
// namespace for the service.
// namespace for the service.
func
NewRPCMetrics
(
procName
,
namespace
string
)
*
RPCMetrics
{
func
MakeRPCMetrics
(
ns
string
,
factory
Factory
)
RPCMetrics
{
if
procName
==
""
{
return
RPCMetrics
{
procName
=
"default"
}
ns
:=
namespace
+
"_"
+
procName
registry
:=
prometheus
.
NewRegistry
()
registry
.
MustRegister
(
collectors
.
NewProcessCollector
(
collectors
.
ProcessCollectorOpts
{}))
registry
.
MustRegister
(
collectors
.
NewGoCollector
())
factory
:=
With
(
registry
)
return
&
RPCMetrics
{
RPCServerRequestsTotal
:
factory
.
NewCounterVec
(
prometheus
.
CounterOpts
{
RPCServerRequestsTotal
:
factory
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
ns
,
Namespace
:
ns
,
Subsystem
:
RPCServerSubsystem
,
Subsystem
:
RPCServerSubsystem
,
...
...
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