collector

package
v0.0.0-...-3f425a8 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUCoreStat

type CPUCoreStat struct {
	CPU string
	CPUStat
}

type CPUStat

type CPUStat struct {
	User   float64
	System float64
	Wait   float64
	Idle   float64
}

type Collector

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

func New

func New(log *log.Logger, opts ...CollectorOption) Collector

func (*Collector) Collect

func (c *Collector) Collect() (SystemStat, error)

type CollectorOption

type CollectorOption func(*Collector)

func WithRawCollector

func WithRawCollector(c RawCollector) CollectorOption

type DiskStat

type DiskStat struct {
	Present bool

	Percent      float64
	InodePercent float64
	ReadBytes    uint64
	WriteBytes   uint64
	ReadTime     uint64
	WriteTime    uint64
	IOTime       uint64
}

type HealthStat

type HealthStat struct {
	Present bool
	Healthy bool
}

type InputFunc

type InputFunc func() (SystemStat, error)

type NetworkStat

type NetworkStat struct {
	Name            string
	BytesSent       uint64
	BytesReceived   uint64
	PacketsSent     uint64
	PacketsReceived uint64
	ErrIn           uint64
	ErrOut          uint64
	DropIn          uint64
	DropOut         uint64
}

type Processor

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

func NewProcessor

func NewProcessor(
	in InputFunc,
	senders []StatsSender,
	interval time.Duration,
	log *log.Logger,
) *Processor

func (*Processor) Run

func (p *Processor) Run()

type ProtoCountersStat

type ProtoCountersStat struct {
	Present bool

	IPForwarding    int64
	UDPNoPorts      int64
	UDPInErrors     int64
	UDPLiteInErrors int64

	TCPActiveOpens int64
	TCPCurrEstab   int64
	TCPRetransSegs int64
}

type RawCollector

type RawCollector interface {
	ProtoCountersWithContext(context.Context, []string) ([]net.ProtoCountersStat, error)
	VirtualMemoryWithContext(context.Context) (*mem.VirtualMemoryStat, error)
	SwapMemoryWithContext(context.Context) (*mem.SwapMemoryStat, error)
	AvgWithContext(context.Context) (*load.AvgStat, error)
	TimesWithContext(context.Context, bool) ([]cpu.TimesStat, error)
	PhysicalCores(context.Context) (int, error)
	UsageWithContext(context.Context, string) (*disk.UsageStat, error)
	NetIOCountersWithContext(context.Context, bool) ([]net.IOCountersStat, error)
	DiskIOCountersWithContext(context.Context, ...string) (map[string]disk.IOCountersStat, error)
	PartitionsWithContext(context.Context, bool) ([]disk.PartitionStat, error)
	InstanceHealth() ([]byte, error)
}

type StatsSender

type StatsSender interface {
	Send(SystemStat)
}

type SystemStat

type SystemStat struct {
	CPUStat
	CPUCoreStats         []CPUCoreStat
	CPUPhysicalCoreCount int
	CPUThreadsPerCore    int

	MemKB      uint64
	MemPercent float64

	SwapKB      uint64
	SwapPercent float64

	Load1M  float64
	Load5M  float64
	Load15M float64

	SystemDisk     DiskStat
	EphemeralDisk  DiskStat
	PersistentDisk DiskStat

	ProtoCounters ProtoCountersStat

	Networks []NetworkStat

	Health HealthStat
}

Jump to

Keyboard shortcuts

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