Back to godoc.org

Package metrics

v0.1.10-docs-prerelease
Latest Go to latest

The highest tagged major version is .

Published: Apr 17, 2020 | License: MIT | Module: github.com/spacemeshos/go-spacemesh

Overview

Package metrics defines metric reporting for the p2p component.

Index

Constants

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

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})
)
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

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier