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
fa8b8b2f
Unverified
Commit
fa8b8b2f
authored
Apr 10, 2023
by
inphi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-batcher: Add Channel Output Bytes Counter
parent
1afd173e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
metrics.go
op-batcher/metrics/metrics.go
+18
-6
No files found.
op-batcher/metrics/metrics.go
View file @
fa8b8b2f
...
...
@@ -58,14 +58,17 @@ type Metrics struct {
PendingBlocksCount
prometheus
.
GaugeVec
BlocksAddedCount
prometheus
.
Gauge
ChannelInputBytes
prometheus
.
GaugeVec
ChannelReadyBytes
prometheus
.
Gauge
ChannelOutputBytes
prometheus
.
Gauge
ChannelClosedReason
prometheus
.
Gauge
ChannelNumFrames
prometheus
.
Gauge
ChannelComprRatio
prometheus
.
Histogram
ChannelInputBytes
prometheus
.
GaugeVec
ChannelReadyBytes
prometheus
.
Gauge
ChannelOutputBytes
prometheus
.
Gauge
ChannelClosedReason
prometheus
.
Gauge
ChannelNumFrames
prometheus
.
Gauge
ChannelComprRatio
prometheus
.
Histogram
ChannelOutputBytesTotal
prometheus
.
Counter
BatcherTxEvs
opmetrics
.
EventVec
lastChannelOutputBytes
int
}
var
_
Metricer
=
(
*
Metrics
)(
nil
)
...
...
@@ -144,6 +147,11 @@ func NewMetrics(procName string) *Metrics {
Help
:
"Compression ratios of closed channel."
,
Buckets
:
append
([]
float64
{
0.1
,
0.2
},
prometheus
.
LinearBuckets
(
0.3
,
0.05
,
14
)
...
),
}),
ChannelOutputBytesTotal
:
factory
.
NewCounter
(
prometheus
.
CounterOpts
{
Namespace
:
ns
,
Name
:
"output_bytes_total"
,
Help
:
"Total number of compressed output bytes from a channel."
,
}),
BatcherTxEvs
:
opmetrics
.
NewEventVec
(
factory
,
ns
,
"batcher_tx"
,
"BatcherTx"
,
[]
string
{
"stage"
}),
}
...
...
@@ -220,6 +228,10 @@ func (m *Metrics) RecordChannelClosed(id derive.ChannelID, numPendingBlocks int,
m
.
ChannelInputBytes
.
WithLabelValues
(
StageClosed
)
.
Set
(
float64
(
inputBytes
))
m
.
ChannelOutputBytes
.
Set
(
float64
(
outputComprBytes
))
outputBytesDelta
:=
outputComprBytes
-
m
.
lastChannelOutputBytes
m
.
lastChannelOutputBytes
=
outputComprBytes
m
.
ChannelOutputBytesTotal
.
Add
(
float64
(
outputBytesDelta
))
var
comprRatio
float64
if
inputBytes
>
0
{
comprRatio
=
float64
(
outputComprBytes
)
/
float64
(
inputBytes
)
...
...
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