Commit efcf30a3 authored by Andreas Bigger's avatar Andreas Bigger

clean flags and metrics

parent eb73defa
......@@ -28,7 +28,7 @@ var (
PeerScoring = cli.StringFlag{
Name: "p2p.scoring.peers",
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.",
Required: false,
Value: "none",
......@@ -46,7 +46,7 @@ var (
TopicScoring = cli.StringFlag{
Name: "p2p.scoring.topics",
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.",
Required: false,
Value: "none",
......
......@@ -299,7 +299,9 @@ func NewMetrics(procName string) *Metrics {
Name: "peer_scores",
Help: "Peer scoring",
}, []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{
Namespace: ns,
......
......@@ -16,11 +16,11 @@ const MaxInMeshScore = 10
// DecayEpoch is the number of epochs to decay the score over.
const DecayEpoch = time.Duration(5)
// DefaultTopicScoreParams is a default instantiation of [pubsub.TopicScoreParams].
// LightTopicScoreParams is a default instantiation of [pubsub.TopicScoreParams].
// See [TopicScoreParams] for detailed documentation.
//
// [TopicScoreParams]: https://pkg.go.dev/github.com/libp2p/go-libp2p-pubsub@v0.8.1#TopicScoreParams
var DefaultTopicScoreParams = func(blockTime uint64) pubsub.TopicScoreParams {
var LightTopicScoreParams = func(blockTime uint64) pubsub.TopicScoreParams {
slot := time.Duration(blockTime) * time.Second
if slot == 0 {
slot = 2 * time.Second
......@@ -87,8 +87,8 @@ var DisabledTopicScoreParams = func(blockTime uint64) pubsub.TopicScoreParams {
// TopicScoreParamsByName is a map of name to [pubsub.TopicScoreParams].
var TopicScoreParamsByName = map[string](func(blockTime uint64) pubsub.TopicScoreParams){
"default": DefaultTopicScoreParams,
"disabled": DisabledTopicScoreParams,
"light": LightTopicScoreParams,
"none": DisabledTopicScoreParams,
}
// AvailableTopicScoreParams returns a list of available topic score params.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment