metrics

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package metrics defines metric reporting for the p2p component.

Index

Constants

View Source
const (
	// Namespace is the metrics namespace //todo: figure out if this can be used better.
	Namespace = "spacemesh"
	// MetricsSubsystem is a subsystem shared by all metrics exposed by this
	// package.
	MetricsSubsystem = "p2p"

	// ProtocolLabel holds the name we use to add a protocol label value
	ProtocolLabel = "protocol"

	// PeerIDLabel holds the name we use to add a protocol label value
	PeerIDLabel = "peer_id"
)

Variables

View Source
var (
	// PropagationQueueLen is the current size of the gossip queue
	PropagationQueueLen = mt.NewGauge("propagate_queue_len", MetricsSubsystem, "Number of messages in the gossip queue", nil)
	// QueueLength is the current size of protocol queues
	QueueLength = mt.NewGauge("protocol_queue_len", MetricsSubsystem, "len of protocol queues", []string{ProtocolLabel})
)
View Source
var (

	// OutboundPeers is the number of outbound peers we have connected
	OutboundPeers = totalPeers.With(typeLabel, "outbound")

	// InboundPeers is the number of inbound peers we have connected
	InboundPeers = totalPeers.With(typeLabel, "inbound")

	// PeerRecv is the num of bytes received from peer
	PeerRecv = prometheus.NewCounterFrom(stdprometheus.CounterOpts{
		Namespace: Namespace,
		Subsystem: MetricsSubsystem,
		Name:      "peer_receive_bytes_total",
		Help:      "Number of bytes received from a given peer.",
	}, []string{PeerIDLabel})

	// PeerSend is the num of bytes sent to peer
	PeerSend metrics.Counter = prometheus.NewCounterFrom(stdprometheus.CounterOpts{
		Namespace: Namespace,
		Subsystem: MetricsSubsystem,
		Name:      "peer_send_bytes_total",
		Help:      "Number of bytes sent to a given peer.",
	}, []string{PeerIDLabel})

	// NewGossipMessages is a metric for newly received gossip messages
	NewGossipMessages = totalGossipMessages.With(messageTypeLabel, "new")
	// OldGossipMessages is a metric for old messages received (duplicates)
	OldGossipMessages = totalGossipMessages.With(messageTypeLabel, "old")
	// InvalidGossipMessages is a metric for invalid messages received
	InvalidGossipMessages = totalGossipMessages.With(messageTypeLabel, "invalid")

	// AddrbookSize is the current size of the discovery
	AddrbookSize = prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
		Namespace: Namespace,
		Subsystem: MetricsSubsystem,
		Name:      "addrbook_size",
		Help:      "Number of peers in the discovery",
	}, []string{})
)

TotalPeers is the total number of peers we have connected

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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