hostmetrics

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotReady = errors.New("resource sampler is warming up")

Functions

This section is empty.

Types

type Collector

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

func NewCollector

func NewCollector(config CollectorConfig) (*Collector, error)

func (*Collector) CollectOnce

func (c *Collector) CollectOnce(ctx context.Context) error

func (*Collector) Run

func (c *Collector) Run(ctx context.Context)

type CollectorConfig

type CollectorConfig struct {
	Store           Store
	Sampler         Sampler
	Interval        time.Duration
	RawRetention    time.Duration
	RollupRetention time.Duration
	Now             func() time.Time
	OnError         func(error)
}

type DiskUsageFunc

type DiskUsageFunc func(string) (used, total uint64, err error)

type LinuxSampler

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

func NewLinuxSampler

func NewLinuxSampler(config LinuxSamplerConfig) (*LinuxSampler, error)

func (*LinuxSampler) Sample

type LinuxSamplerConfig

type LinuxSamplerConfig struct {
	ProcStatPath    string
	ProcMeminfoPath string
	DiskPath        string
	CPUCores        int
	Now             func() time.Time
	DiskUsage       DiskUsageFunc
}

type Sampler

type Sampler interface {
	Sample(context.Context) (control.ResourceSample, error)
}

type Store

type Store interface {
	ActiveResourceScope(context.Context) (control.ResourceScope, bool, error)
	AppendResourceSample(context.Context, control.ResourceSample) error
	CompactResourceSamples(context.Context, time.Time, time.Time) error
}

Jump to

Keyboard shortcuts

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