tracer

package
v0.31.21-disable-dht Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2023 License: AGPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// MeshLogIntervalMsg is the message logged by the tracer every logInterval.
	MeshLogIntervalMsg = "topic mesh peers of local node since last heartbeat"

	// MeshLogIntervalWarnMsg is the message logged by the tracer every logInterval if there are unknown peers in the mesh.
	MeshLogIntervalWarnMsg = "unknown peers in topic mesh peers of local node since last heartbeat"
)
View Source
const (
	PeerScoreLogMessage = "peer score snapshot update"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GossipSubMeshTracer

type GossipSubMeshTracer struct {
	component.Component
	pubsub.RawTracer
	// contains filtered or unexported fields
}

The GossipSubMeshTracer component in the GossipSub pubsub.RawTracer that is designed to track the local mesh peers for each topic. By logging the mesh peers and updating the local mesh size metric, the GossipSubMeshTracer provides insights into the behavior of the topology.

This component also provides real-time and historical visibility into the topology. The GossipSubMeshTracer logs the mesh peers of the local node for each topic at a regular interval, enabling users to monitor the state of the mesh network and take appropriate action. Additionally, it allows users to configure the logging interval.

func NewGossipSubMeshTracer

func NewGossipSubMeshTracer(
	logger zerolog.Logger,
	metrics module.GossipSubLocalMeshMetrics,
	idProvider module.IdentityProvider,
	loggerInterval time.Duration) *GossipSubMeshTracer

func (*GossipSubMeshTracer) GetMeshPeers

func (t *GossipSubMeshTracer) GetMeshPeers(topic string) []peer.ID

GetMeshPeers returns the local mesh peers for the given topic.

func (*GossipSubMeshTracer) Graft

func (t *GossipSubMeshTracer) Graft(p peer.ID, topic string)

Graft is called when a peer is added to a topic mesh. The tracer uses this to track the mesh peers.

func (*GossipSubMeshTracer) Prune

func (t *GossipSubMeshTracer) Prune(p peer.ID, topic string)

Prune is called when a peer is removed from a topic mesh. The tracer uses this to track the mesh peers.

type GossipSubNoopTracer

type GossipSubNoopTracer struct {
}

GossipSubNoopTracer is a no-op tracer that implements the RawTracer interface for the Flow network.

func NewGossipSubNoopTracer

func NewGossipSubNoopTracer() *GossipSubNoopTracer

func (*GossipSubNoopTracer) AddPeer

func (t *GossipSubNoopTracer) AddPeer(p peer.ID, proto protocol.ID)

func (*GossipSubNoopTracer) DeliverMessage

func (t *GossipSubNoopTracer) DeliverMessage(msg *pubsub.Message)

func (*GossipSubNoopTracer) DropRPC

func (t *GossipSubNoopTracer) DropRPC(rpc *pubsub.RPC, p peer.ID)

func (*GossipSubNoopTracer) DuplicateMessage

func (t *GossipSubNoopTracer) DuplicateMessage(msg *pubsub.Message)

func (*GossipSubNoopTracer) Graft

func (t *GossipSubNoopTracer) Graft(p peer.ID, topic string)

func (*GossipSubNoopTracer) Join

func (t *GossipSubNoopTracer) Join(topic string)

func (*GossipSubNoopTracer) Leave

func (t *GossipSubNoopTracer) Leave(topic string)

func (*GossipSubNoopTracer) Prune

func (t *GossipSubNoopTracer) Prune(p peer.ID, topic string)

func (*GossipSubNoopTracer) RecvRPC

func (t *GossipSubNoopTracer) RecvRPC(rpc *pubsub.RPC)

func (*GossipSubNoopTracer) RejectMessage

func (t *GossipSubNoopTracer) RejectMessage(msg *pubsub.Message, reason string)

func (*GossipSubNoopTracer) RemovePeer

func (t *GossipSubNoopTracer) RemovePeer(p peer.ID)

func (*GossipSubNoopTracer) SendRPC

func (t *GossipSubNoopTracer) SendRPC(rpc *pubsub.RPC, p peer.ID)

func (*GossipSubNoopTracer) ThrottlePeer

func (t *GossipSubNoopTracer) ThrottlePeer(p peer.ID)

func (*GossipSubNoopTracer) UndeliverableMessage

func (t *GossipSubNoopTracer) UndeliverableMessage(msg *pubsub.Message)

func (*GossipSubNoopTracer) ValidateMessage

func (t *GossipSubNoopTracer) ValidateMessage(msg *pubsub.Message)

type GossipSubScoreTracer

type GossipSubScoreTracer struct {
	component.Component
	// contains filtered or unexported fields
}

GossipSubScoreTracer is a tracer that keeps track of the peer scores of the gossipsub router. It is used to log the peer scores at regular intervals.

func NewGossipSubScoreTracer

func NewGossipSubScoreTracer(
	logger zerolog.Logger,
	provider module.IdentityProvider,
	collector module.GossipSubScoringMetrics,
	updateInterval time.Duration) *GossipSubScoreTracer

func (*GossipSubScoreTracer) GetAppScore

func (g *GossipSubScoreTracer) GetAppScore(peerID peer.ID) (float64, bool)

GetAppScore returns the application score for the given peer.

func (*GossipSubScoreTracer) GetBehaviourPenalty

func (g *GossipSubScoreTracer) GetBehaviourPenalty(peerID peer.ID) (float64, bool)

GetBehaviourPenalty returns the behaviour penalty for the given peer.

func (*GossipSubScoreTracer) GetIPColocationFactor

func (g *GossipSubScoreTracer) GetIPColocationFactor(peerID peer.ID) (float64, bool)

GetIPColocationFactor returns the IP colocation factor for the given peer.

func (*GossipSubScoreTracer) GetScore

func (g *GossipSubScoreTracer) GetScore(peerID peer.ID) (float64, bool)

GetScore returns the overall score for the given peer.

func (*GossipSubScoreTracer) GetTopicScores

func (g *GossipSubScoreTracer) GetTopicScores(peerID peer.ID) (map[string]p2p.TopicScoreSnapshot, bool)

GetTopicScores returns the topic scores for the given peer. The returned map is keyed by topic name.

func (*GossipSubScoreTracer) UpdateInterval

func (g *GossipSubScoreTracer) UpdateInterval() time.Duration

UpdateInterval returns the interval at which the tracer expects to receive updates from the gossipsub router.

func (*GossipSubScoreTracer) UpdatePeerScoreSnapshots

func (g *GossipSubScoreTracer) UpdatePeerScoreSnapshots(snapshot map[peer.ID]*p2p.PeerScoreSnapshot)

UpdatePeerScoreSnapshots updates the tracer's snapshot of the peer scores. It is called by the gossipsub router. It is non-blocking and asynchrounous. If there is no update pending, it queues an update. If there is an update pending, it drops the update.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL