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
4e19f015
Commit
4e19f015
authored
Jan 20, 2023
by
asnared
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: metrics histogram
parent
117fd621
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
metrics.go
op-node/metrics/metrics.go
+11
-2
peer_score.go
op-node/p2p/peer_score.go
+3
-3
No files found.
op-node/metrics/metrics.go
View file @
4e19f015
...
...
@@ -114,7 +114,7 @@ type Metrics struct {
// P2P Metrics
PeerCount
prometheus
.
Gauge
StreamCount
prometheus
.
Gauge
PeerScores
map
[
peer
.
ID
]
float64
PeerScores
*
prometheus
.
HistogramVec
GossipEventsTotal
*
prometheus
.
CounterVec
BandwidthTotal
*
prometheus
.
GaugeVec
...
...
@@ -284,6 +284,15 @@ func NewMetrics(procName string) *Metrics {
Name
:
"stream_count"
,
Help
:
"Count of currently connected p2p streams"
,
}),
PeerScores
:
factory
.
NewHistogramVec
(
prometheus
.
HistogramOpts
{
Namespace
:
ns
,
Subsystem
:
"p2p"
,
Name
:
"peer_scores"
,
Buckets
:
[]
float64
{
.005
,
.01
,
.025
,
.05
,
.1
,
.25
,
.5
,
1
,
2.5
,
5
,
10
},
Help
:
"Histogram of p2p peer scores"
,
},
[]
string
{
"method"
,
}),
GossipEventsTotal
:
factory
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
ns
,
Subsystem
:
"p2p"
,
...
...
@@ -463,7 +472,7 @@ func (m *Metrics) RecordGossipEvent(evType int32) {
}
func
(
m
*
Metrics
)
RecordPeerScoring
(
peerID
peer
.
ID
,
score
float64
)
{
m
.
PeerScores
[
peerID
]
=
score
m
.
PeerScores
.
WithLabelValues
(
peerID
.
String
())
.
Observe
(
score
)
}
func
(
m
*
Metrics
)
IncPeerCount
()
{
...
...
op-node/p2p/peer_score.go
View file @
4e19f015
...
...
@@ -29,8 +29,8 @@ func NewPeerScoreParams() pubsub.PeerScoreParams {
BehaviourPenaltyWeight
:
-
1
,
BehaviourPenaltyDecay
:
0.999
,
DecayInterval
:
24
*
time
.
Hour
,
DecayToZero
:
0.01
,
RetainScore
:
math
.
MaxInt64
,
DecayToZero
:
0.0
0
1
,
RetainScore
:
math
.
MaxInt64
,
// We want to keep scores indefinitely - don't refresh on connect/disconnect
SeenMsgTTL
:
0
,
// Defaults to global TimeCacheDuration when 0
}
}
...
...
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