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
efcf30a3
Commit
efcf30a3
authored
Mar 10, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean flags and metrics
parent
eb73defa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
p2p_flags.go
op-node/flags/p2p_flags.go
+2
-2
metrics.go
op-node/metrics/metrics.go
+3
-1
topic_params.go
op-node/p2p/topic_params.go
+4
-4
No files found.
op-node/flags/p2p_flags.go
View file @
efcf30a3
...
@@ -28,7 +28,7 @@ var (
...
@@ -28,7 +28,7 @@ var (
PeerScoring
=
cli
.
StringFlag
{
PeerScoring
=
cli
.
StringFlag
{
Name
:
"p2p.scoring.peers"
,
Name
:
"p2p.scoring.peers"
,
Usage
:
"Sets the peer scoring strategy for the P2P stack. "
+
Usage
:
"Sets the peer scoring strategy for the P2P stack. "
+
"Can be one of: none
, light, full
."
+
"Can be one of: none
or light
."
+
"Custom scoring strategies can be defined in the config file."
,
"Custom scoring strategies can be defined in the config file."
,
Required
:
false
,
Required
:
false
,
Value
:
"none"
,
Value
:
"none"
,
...
@@ -46,7 +46,7 @@ var (
...
@@ -46,7 +46,7 @@ var (
TopicScoring
=
cli
.
StringFlag
{
TopicScoring
=
cli
.
StringFlag
{
Name
:
"p2p.scoring.topics"
,
Name
:
"p2p.scoring.topics"
,
Usage
:
"Sets the topic scoring strategy. "
+
Usage
:
"Sets the topic scoring strategy. "
+
"Can be one of: none
, light, full
."
+
"Can be one of: none
or light
."
+
"Custom scoring strategies can be defined in the config file."
,
"Custom scoring strategies can be defined in the config file."
,
Required
:
false
,
Required
:
false
,
Value
:
"none"
,
Value
:
"none"
,
...
...
op-node/metrics/metrics.go
View file @
efcf30a3
...
@@ -299,7 +299,9 @@ func NewMetrics(procName string) *Metrics {
...
@@ -299,7 +299,9 @@ func NewMetrics(procName string) *Metrics {
Name
:
"peer_scores"
,
Name
:
"peer_scores"
,
Help
:
"Peer scoring"
,
Help
:
"Peer scoring"
,
},
[]
string
{
},
[]
string
{
"peerid"
,
// No label names here since peer ids would open a service attack vector.
// Each peer id would be a separate metric, flooding prometheus.
// See: https://prometheus.io/docs/practices/naming/#labels
}),
}),
GossipEventsTotal
:
factory
.
NewCounterVec
(
prometheus
.
CounterOpts
{
GossipEventsTotal
:
factory
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
ns
,
Namespace
:
ns
,
...
...
op-node/p2p/topic_params.go
View file @
efcf30a3
...
@@ -16,11 +16,11 @@ const MaxInMeshScore = 10
...
@@ -16,11 +16,11 @@ const MaxInMeshScore = 10
// DecayEpoch is the number of epochs to decay the score over.
// DecayEpoch is the number of epochs to decay the score over.
const
DecayEpoch
=
time
.
Duration
(
5
)
const
DecayEpoch
=
time
.
Duration
(
5
)
//
Defaul
tTopicScoreParams is a default instantiation of [pubsub.TopicScoreParams].
//
Ligh
tTopicScoreParams is a default instantiation of [pubsub.TopicScoreParams].
// See [TopicScoreParams] for detailed documentation.
// See [TopicScoreParams] for detailed documentation.
//
//
// [TopicScoreParams]: https://pkg.go.dev/github.com/libp2p/go-libp2p-pubsub@v0.8.1#TopicScoreParams
// [TopicScoreParams]: https://pkg.go.dev/github.com/libp2p/go-libp2p-pubsub@v0.8.1#TopicScoreParams
var
Defaul
tTopicScoreParams
=
func
(
blockTime
uint64
)
pubsub
.
TopicScoreParams
{
var
Ligh
tTopicScoreParams
=
func
(
blockTime
uint64
)
pubsub
.
TopicScoreParams
{
slot
:=
time
.
Duration
(
blockTime
)
*
time
.
Second
slot
:=
time
.
Duration
(
blockTime
)
*
time
.
Second
if
slot
==
0
{
if
slot
==
0
{
slot
=
2
*
time
.
Second
slot
=
2
*
time
.
Second
...
@@ -87,8 +87,8 @@ var DisabledTopicScoreParams = func(blockTime uint64) pubsub.TopicScoreParams {
...
@@ -87,8 +87,8 @@ var DisabledTopicScoreParams = func(blockTime uint64) pubsub.TopicScoreParams {
// TopicScoreParamsByName is a map of name to [pubsub.TopicScoreParams].
// TopicScoreParamsByName is a map of name to [pubsub.TopicScoreParams].
var
TopicScoreParamsByName
=
map
[
string
](
func
(
blockTime
uint64
)
pubsub
.
TopicScoreParams
){
var
TopicScoreParamsByName
=
map
[
string
](
func
(
blockTime
uint64
)
pubsub
.
TopicScoreParams
){
"
default"
:
Defaul
tTopicScoreParams
,
"
light"
:
Ligh
tTopicScoreParams
,
"
disabled"
:
DisabledTopicScoreParams
,
"
none"
:
DisabledTopicScoreParams
,
}
}
// AvailableTopicScoreParams returns a list of available topic score params.
// AvailableTopicScoreParams returns a list of available topic score params.
...
...
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