metric

package
v2.4.10 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExponentMetric

func NewExponentMetric(interval int, meanTime int) *exponentMetric

func NewMetricManager

func NewMetricManager(interval int) *metricsManager

Types

type DataMetric

type DataMetric interface {
	// APS shows average bytes per second in a given period
	APS() int64
	// LoadScore is calulated value of network load.
	LoadScore() int64
	// add bytes transferred
	AddBytes(byteSize int)
	// Calculate should be called peridically with exact interval and a single thread
	Calculate()
}

DataMetric hold data transfer of a peer. It shows eventually consistent aps and load score.

func NewExponentMetric15

func NewExponentMetric15(tickInterval int) DataMetric

NewExponentMetric15

func NewExponentMetric5

func NewExponentMetric5(tickInterval int) DataMetric

type MetricsManager

type MetricsManager interface {
	Start()
	Stop()

	NewMetric(pid types.PeerID, manNum uint32) *PeerMetric
	Remove(pid types.PeerID, manNum uint32) *PeerMetric

	Metric(pid types.PeerID) (*PeerMetric, bool)
	Metrics() []*PeerMetric

	Summary() map[string]interface{}
	PrintMetrics() string
}

type PeerMetric

type PeerMetric struct {
	PeerID types.PeerID

	Since time.Time

	InMetric  DataMetric
	OutMetric DataMetric
	// contains filtered or unexported fields
}

func (*PeerMetric) InputAdded

func (m *PeerMetric) InputAdded(added int)

Deprecated

func (*PeerMetric) OnRead

func (m *PeerMetric) OnRead(protocol p2pcommon.SubProtocol, read int)

func (*PeerMetric) OnWrite

func (m *PeerMetric) OnWrite(protocol p2pcommon.SubProtocol, write int)

func (*PeerMetric) OutputAdded

func (m *PeerMetric) OutputAdded(added int)

Deprecated

func (*PeerMetric) TotalIn

func (m *PeerMetric) TotalIn() int64

func (*PeerMetric) TotalOut

func (m *PeerMetric) TotalOut() int64

Jump to

Keyboard shortcuts

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