metrics

package module
v2.1.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: MIT Imports: 3 Imported by: 0

README

go-libp2p-metrics

Coverage Status Travis CI

A connection wrapper for go-libp2p that provides bandwidth statistics for wrapped connections.

Table of Contents

Install

make install

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Jeromy Johnson

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BandwidthCounter

type BandwidthCounter struct {
	// contains filtered or unexported fields
}

func NewBandwidthCounter

func NewBandwidthCounter() *BandwidthCounter

func (*BandwidthCounter) GetBandwidthForPeer

func (bwc *BandwidthCounter) GetBandwidthForPeer(p peer.ID) (out Stats)

func (*BandwidthCounter) GetBandwidthForProtocol

func (bwc *BandwidthCounter) GetBandwidthForProtocol(proto protocol.ID) (out Stats)

func (*BandwidthCounter) GetBandwidthTotals

func (bwc *BandwidthCounter) GetBandwidthTotals() (out Stats)

func (*BandwidthCounter) LogRecvMessage

func (bwc *BandwidthCounter) LogRecvMessage(size int64)

func (*BandwidthCounter) LogRecvMessageStream

func (bwc *BandwidthCounter) LogRecvMessageStream(size int64, proto protocol.ID, p peer.ID)

func (*BandwidthCounter) LogSentMessage

func (bwc *BandwidthCounter) LogSentMessage(size int64)

func (*BandwidthCounter) LogSentMessageStream

func (bwc *BandwidthCounter) LogSentMessageStream(size int64, proto protocol.ID, p peer.ID)

type Reporter

type Reporter interface {
	LogSentMessage(int64)
	LogRecvMessage(int64)
	LogSentMessageStream(int64, protocol.ID, peer.ID)
	LogRecvMessageStream(int64, protocol.ID, peer.ID)
	GetBandwidthForPeer(peer.ID) Stats
	GetBandwidthForProtocol(protocol.ID) Stats
	GetBandwidthTotals() Stats
}

type Stats

type Stats struct {
	TotalIn  int64
	TotalOut int64
	RateIn   float64
	RateOut  float64
}

Jump to

Keyboard shortcuts

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