tracer

package
v0.33.37-experimental-... Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 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
	// 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) AddPeer added in v0.33.1

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

AddPeer is called by GossipSub as a callback when a peer is added to the local node on a protocol, i.e., the local node is connected to the peer on a protocol. The peer may or may not be subscribed to any topic.

func (*GossipSubMeshTracer) DeliverMessage added in v0.33.1

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

DeliverMessage is called by GossipSub as a callback when the local node delivers a message to all subscribers of the topic.

func (*GossipSubMeshTracer) DropRPC added in v0.33.1

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

DropRPC is called by GossipSub as a callback when an outbound RPC message is dropped by the local node, typically because the local node outbound message queue is full; or the RPC is big and the local node cannot fragment it.

func (*GossipSubMeshTracer) DuplicateMessage added in v0.33.1

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

DuplicateMessage is called by GossipSub as a callback when a duplicate message is received by the local node.

func (*GossipSubMeshTracer) GetLocalMeshPeers added in v0.33.1

func (t *GossipSubMeshTracer) GetLocalMeshPeers(topic channels.Topic) []peer.ID

GetLocalMeshPeers returns the local mesh peers for the given topic. Args: - topic: the topic. Returns: - []peer.ID: the local mesh peers for the given topic.

func (*GossipSubMeshTracer) Graft

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

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

func (*GossipSubMeshTracer) Join added in v0.33.1

func (t *GossipSubMeshTracer) Join(topic string)

Join is called by GossipSub as a callback when the local node joins a topic.

func (*GossipSubMeshTracer) LastHighestIHaveRPCSize added in v0.32.0

func (t *GossipSubMeshTracer) LastHighestIHaveRPCSize() int64

LastHighestIHaveRPCSize returns the last highest RPC iHave message sent.

func (*GossipSubMeshTracer) Leave added in v0.33.1

func (t *GossipSubMeshTracer) Leave(topic string)

Leave is called by GossipSub as a callback when the local node leaves a topic.

func (*GossipSubMeshTracer) Prune

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

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

func (*GossipSubMeshTracer) RecvRPC added in v0.33.1

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

RecvRPC is called by GossipSub as a callback when an inbound RPC message is received by the local node, note that the RPC already passed the RPC inspection, hence its statistics may be different from the RPC inspector metrics, as the RPC inspector metrics are updated before the RPC inspection, and the RPC may gone through truncation or rejection. This callback tracks the RPC messages as they are completely received by the local GossipSub router.

func (*GossipSubMeshTracer) RejectMessage added in v0.33.1

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

RejectMessage is called by GossipSub as a callback when a message is rejected by the local node. The message may be rejected for a variety of reasons, but the most common reason is that the message is invalid with respect to signature. Any message that arrives at the local node should contain the peer id of the source (i.e., the peer that created the message), the networking public key of the source, and the signature of the message. The local node uses this information to verify the message. If any of the information is missing or invalid, the message is rejected.

func (*GossipSubMeshTracer) RemovePeer added in v0.33.1

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

RemovePeer is called by GossipSub as a callback when a peer is removed from the local node, i.e., the local node is no longer connected to the peer.

func (*GossipSubMeshTracer) SendRPC added in v0.32.0

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

SendRPC is called by GossipSub 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) ThrottlePeer added in v0.33.1

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

ThrottlePeer is called by GossipSub when a peer is throttled by the local node, i.e., the local node is not accepting any pubsub message from the peer but may still accept control messages.

func (*GossipSubMeshTracer) UndeliverableMessage added in v0.33.1

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

UndeliverableMessage is called by GossipSub as a callback when a message is dropped by the local node, typically because the local node outbound message queue is full; or the message is big and the local node cannot fragment it.

func (*GossipSubMeshTracer) ValidateMessage added in v0.33.1

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

ValidateMessage is called by GossipSub as a callback when a message is received by the local node and entered the validation phase. As the result of the validation, the message may be rejected or passed to the application (i.e., Flow protocol).

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.LocalGossipSubRouterMetrics
	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