monitoring

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCPUStat

func GetCPUStat() (*models.CPUStat, error)

GetCPUStat return the cpu time statistics

func GetCPUs

func GetCPUs() int

GetCPUs returns the number of logical cores in the system

func GetNetStat

func GetNetStat(ctx context.Context) ([]net.IOCountersStat, error)

GetNetStat return the network usage statistics

Types

type CPUStatGetter

type CPUStatGetter func() (*models.CPUStat, error)

type DiskUsageStatGetter

type DiskUsageStatGetter func(ctx context.Context, path string) (*disk.UsageStat, error)

type MemoryStatGetter

type MemoryStatGetter func() (*mem.VirtualMemoryStat, error)

type NativePusher

type NativePusher interface {
	// Start starts push metrics data in period
	Start()
	// Stop stops push metrics data
	Stop()
}

NativePusher collects metrics from internal lin-metric registry, then pushes metrics data via http.

func NewNativeProtoPusher

func NewNativeProtoPusher(
	ctx context.Context,
	endpoint string,
	interval time.Duration,
	pushTimeout time.Duration,
	r *linmetric.Registry,
	globalKeyValues tag.Tags,
) NativePusher

NewNativeProtoPusher creates a new native pusher

type NetStatGetter

type NetStatGetter func(ctx context.Context) ([]net.IOCountersStat, error)

type SystemCollector

type SystemCollector struct {

	// used for mock
	MemoryStatGetter    MemoryStatGetter
	CPUStatGetter       CPUStatGetter
	DiskUsageStatGetter DiskUsageStatGetter
	NetStatGetter       NetStatGetter
	// contains filtered or unexported fields
}

SystemCollector collects the system stat

func NewSystemCollector

func NewSystemCollector(
	ctx context.Context,
	storage string,
	statistics *metrics.SystemStatistics,
) *SystemCollector

NewSystemCollector creates a new system stat collector

func (*SystemCollector) Run

func (r *SystemCollector) Run()

Run starts a background goroutine that collects the monitoring stat

Jump to

Keyboard shortcuts

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