Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPUCoreStat ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector aggregates the system-metrics snapshot for a single VM.
Concurrency: Collect is intended to be called from a single goroutine. prevTimesStat and prevCoreStats are mutated in place by Collect and have no synchronization; clockDriftErrors is the lone exception (touched via atomic.AddUint64 / LoadUint64) so a future caller reading the running total from another goroutine still sees a consistent value.
func (*Collector) Collect ¶
func (c *Collector) Collect() (SystemStat, error)
type CollectorOption ¶
type CollectorOption func(*Collector)
func WithClockSource ¶
func WithClockSource(ts clockdrift.TimeSource) CollectorOption
WithClockSource overrides the default chronyc-on-PATH discovery used by New. Pass a stub TimeSource in tests to make outcomes deterministic regardless of whether the host has chronyc installed.
Passing nil is a no-op (auto-discovery still runs); use WithoutClockSource to disable clock drift collection explicitly.
func WithRawCollector ¶
func WithRawCollector(c RawCollector) CollectorOption
func WithoutClockSource ¶
func WithoutClockSource() CollectorOption
WithoutClockSource disables clock drift collection entirely, bypassing the default chronyc-on-PATH discovery. The collector emits no clock_drift_* metrics and reports ClockDriftEnabled == false.
type HealthStat ¶
type InputFunc ¶
type InputFunc func() (SystemStat, error)
type NetworkStat ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessor ¶
type ProtoCountersStat ¶
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
ClockDrift *clockdrift.TimeSyncData
ClockDriftEnabled bool
ClockDriftErrorsTotal uint64
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package clockdrift collects NTP/chrony time-synchronization data from the host for emission as PCI-DSS 10.6 audit evidence.
|
Package clockdrift collects NTP/chrony time-synchronization data from the host for emission as PCI-DSS 10.6 audit evidence. |