hostsample

package
v0.209.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hostsample publishes a coarse host CPU % and RAM used/total for /fleet/health. It is a background sampler like fleetnode's VRAM Sampler: the health handler only ever Loads the last value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sample

type Sample struct {
	CPUPct      int // 0-100
	RAMUsedGiB  float64
	RAMTotalGiB float64
	At          time.Time
	Known       bool
}

type Sampler

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

func Start

func Start(ctx context.Context, interval time.Duration) *Sampler

Start samples every interval. The first CPU % needs two readings, but the BASELINE reading is taken before the loop starts (not on the first tick), so the first publish happens at the first tick, not the second.

func (*Sampler) Load

func (s *Sampler) Load() (Sample, bool)

Jump to

Keyboard shortcuts

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