Commit efcf30a3 authored by Andreas Bigger's avatar Andreas Bigger

clean flags and metrics

parent eb73defa
...@@ -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",
......
...@@ -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,
......
...@@ -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)
// DefaultTopicScoreParams is a default instantiation of [pubsub.TopicScoreParams]. // LightTopicScoreParams 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 DefaultTopicScoreParams = func(blockTime uint64) pubsub.TopicScoreParams { var LightTopicScoreParams = 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": DefaultTopicScoreParams, "light": LightTopicScoreParams,
"disabled": DisabledTopicScoreParams, "none": DisabledTopicScoreParams,
} }
// AvailableTopicScoreParams returns a list of available topic score params. // 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