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
029566b6
Commit
029566b6
authored
Apr 10, 2023
by
Joshua Gutow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-service/metrics: Add subssystem to event metrics
parent
dca2cb63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
6 deletions
+10
-6
metrics.go
op-batcher/metrics/metrics.go
+2
-2
event.go
op-service/metrics/event.go
+6
-2
tx_metrics.go
op-service/txmgr/metrics/tx_metrics.go
+2
-2
No files found.
op-batcher/metrics/metrics.go
View file @
029566b6
...
...
@@ -100,7 +100,7 @@ func NewMetrics(procName string) *Metrics {
Help
:
"1 if the op-batcher has finished starting up"
,
}),
ChannelEvs
:
opmetrics
.
NewEventVec
(
factory
,
ns
,
"channel"
,
"Channel"
,
[]
string
{
"stage"
}),
ChannelEvs
:
opmetrics
.
NewEventVec
(
factory
,
ns
,
"
"
,
"
channel"
,
"Channel"
,
[]
string
{
"stage"
}),
PendingBlocksCount
:
*
factory
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
Namespace
:
ns
,
...
...
@@ -145,7 +145,7 @@ func NewMetrics(procName string) *Metrics {
Buckets
:
append
([]
float64
{
0.1
,
0.2
},
prometheus
.
LinearBuckets
(
0.3
,
0.05
,
14
)
...
),
}),
BatcherTxEvs
:
opmetrics
.
NewEventVec
(
factory
,
ns
,
"batcher_tx"
,
"BatcherTx"
,
[]
string
{
"stage"
}),
BatcherTxEvs
:
opmetrics
.
NewEventVec
(
factory
,
ns
,
"
"
,
"
batcher_tx"
,
"BatcherTx"
,
[]
string
{
"stage"
}),
}
}
...
...
op-service/metrics/event.go
View file @
029566b6
...
...
@@ -16,17 +16,19 @@ func (e *Event) Record() {
e
.
LastTime
.
SetToCurrentTime
()
}
func
NewEvent
(
factory
Factory
,
ns
string
,
name
string
,
displayName
string
)
Event
{
func
NewEvent
(
factory
Factory
,
ns
string
,
subsystem
string
,
name
string
,
displayName
string
)
Event
{
return
Event
{
Total
:
factory
.
NewCounter
(
prometheus
.
CounterOpts
{
Namespace
:
ns
,
Name
:
fmt
.
Sprintf
(
"%s_total"
,
name
),
Help
:
fmt
.
Sprintf
(
"Count of %s events"
,
displayName
),
Subsystem
:
subsystem
,
}),
LastTime
:
factory
.
NewGauge
(
prometheus
.
GaugeOpts
{
Namespace
:
ns
,
Name
:
fmt
.
Sprintf
(
"last_%s_unix"
,
name
),
Help
:
fmt
.
Sprintf
(
"Timestamp of last %s event"
,
displayName
),
Subsystem
:
subsystem
,
}),
}
}
...
...
@@ -41,17 +43,19 @@ func (e *EventVec) Record(lvs ...string) {
e
.
LastTime
.
WithLabelValues
(
lvs
...
)
.
SetToCurrentTime
()
}
func
NewEventVec
(
factory
Factory
,
ns
string
,
name
string
,
displayName
string
,
labelNames
[]
string
)
EventVec
{
func
NewEventVec
(
factory
Factory
,
ns
string
,
subsystem
string
,
name
string
,
displayName
string
,
labelNames
[]
string
)
EventVec
{
return
EventVec
{
Total
:
*
factory
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
ns
,
Name
:
fmt
.
Sprintf
(
"%s_total"
,
name
),
Help
:
fmt
.
Sprintf
(
"Count of %s events"
,
displayName
),
Subsystem
:
subsystem
,
},
labelNames
),
LastTime
:
*
factory
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
Namespace
:
ns
,
Name
:
fmt
.
Sprintf
(
"last_%s_unix"
,
name
),
Help
:
fmt
.
Sprintf
(
"Timestamp of last %s event"
,
displayName
),
Subsystem
:
subsystem
,
},
labelNames
),
}
}
op-service/txmgr/metrics/tx_metrics.go
View file @
029566b6
...
...
@@ -73,8 +73,8 @@ func MakeTxMetrics(ns string, factory metrics.Factory) TxMetrics {
Help
:
"Count of publish errors. Labells are sanitized error strings"
,
Subsystem
:
"txmgr"
,
},
[]
string
{
"error"
}),
confirmEvent
:
metrics
.
NewEventVec
(
factory
,
ns
,
"confirm"
,
"tx confirm"
,
[]
string
{
"status"
}),
publishEvent
:
metrics
.
NewEvent
(
factory
,
ns
,
"publish"
,
"tx publish"
),
confirmEvent
:
metrics
.
NewEventVec
(
factory
,
ns
,
"
txmgr"
,
"
confirm"
,
"tx confirm"
,
[]
string
{
"status"
}),
publishEvent
:
metrics
.
NewEvent
(
factory
,
ns
,
"
txmgr"
,
"
publish"
,
"tx publish"
),
rpcError
:
factory
.
NewCounter
(
prometheus
.
CounterOpts
{
Namespace
:
ns
,
Name
:
"rpc_error_count"
,
...
...
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