tracer

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: AGPL-3.0 Imports: 18 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(config *GossipSubMeshTracerConfig) *GossipSubMeshTracer

NewGossipSubMeshTracer creates a new *GossipSubMeshTracer. Args: - *GossipSubMeshTracerConfig: the mesh tracer config. Returns: - *GossipSubMeshTracer: new mesh tracer.

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) LastHighestIHaveRPCSize added in v0.32.0

func (t *GossipSubMeshTracer) LastHighestIHaveRPCSize() int64

LastHighestIHaveRPCSize returns the last highest RPC iHave message sent.

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.

func (*GossipSubMeshTracer) SendRPC added in v0.32.0

func (t *GossipSubMeshTracer) SendRPC(rpc *pubsub.RPC, _ peer.ID)

SendRPC is called when a RPC is sent. Currently, the GossipSubMeshTracer tracks iHave RPC messages that have been sent. This function can be updated to track other control messages in the future as required.

func (*GossipSubMeshTracer) WasIHaveRPCSent added in v0.32.0

func (t *GossipSubMeshTracer) WasIHaveRPCSent(messageID string) bool

WasIHaveRPCSent returns true if an iHave control message for the messageID was sent, otherwise false.

type GossipSubMeshTracerConfig added in v0.32.0

type GossipSubMeshTracerConfig struct {
	network.NetworkingType
	metrics.HeroCacheMetricsFactory
	Logger                             zerolog.Logger
	Metrics                            module.GossipSubLocalMeshMetrics
	IDProvider                         module.IdentityProvider
	LoggerInterval                     time.Duration
	RpcSentTrackerCacheSize            uint32
	RpcSentTrackerWorkerQueueCacheSize uint32
	RpcSentTrackerNumOfWorkers         int
}

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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