metrics

package
v0.0.0-...-03fae82 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

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

func NewMetrics

func NewMetrics(tickerInterval time.Duration) *Metrics

NewMetrics creates a new Metrics instance and starts a goroutine to update bitRate, packetRate, errorRate, and avgDepth every interval.

func (*Metrics) AddBits

func (m *Metrics) AddBits(bits uint64)

AddBits increments the bit counter by the specified amount

func (*Metrics) AddError

func (m *Metrics) AddError(count uint64)

AddError increments the error counter by the specified amount

func (*Metrics) AddPacket

func (m *Metrics) AddPacket(count uint64)

AddPacket increments the packet counter by the specified amount

func (*Metrics) AddSample

func (m *Metrics) AddSample(sample uint64)

AddSample adds a depth sample to be averaged

func (*Metrics) GetAvgDepth

func (m *Metrics) GetAvgDepth() uint64

GetAvgDepth returns the current average depth

func (*Metrics) GetBitRate

func (m *Metrics) GetBitRate() uint64

GetBitRate returns the current bits per second rate

func (*Metrics) GetErrorRate

func (m *Metrics) GetErrorRate() uint64

GetErrorRate returns the current errors per second rate

func (*Metrics) GetPacketRate

func (m *Metrics) GetPacketRate() uint64

GetPacketRate returns the current packets per second rate

func (*Metrics) Stop

func (m *Metrics) Stop()

Stop gracefully stops the goroutine by canceling the context

Jump to

Keyboard shortcuts

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