psutil

package
v2.280.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package psutil provides debug endpoints and profiling helpers for go-service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(cont *content.Content) http.HandlerFunc

NewHandler for debug.

func Register

func Register(name env.Name, cont *content.Content, mux *http.ServeMux)

Register for debug.

Types

type CPU

type CPU struct {
	// Info contains static CPU information (model, cores, cache sizes, etc.).
	Info []cpu.InfoStat `yaml:"info,omitempty" json:"info,omitempty" toml:"info,omitempty"`

	// Times contains per-CPU time statistics (user/system/idle/etc.).
	Times []cpu.TimesStat `yaml:"times,omitempty" json:"times,omitempty" toml:"times,omitempty"`
}

CPU contains CPU details collected for the debug endpoint.

func NewCPU

func NewCPU(ctx context.Context) *CPU

NewCPU for debug.

type Host

type Host struct {
	// Info contains host information (OS, platform, uptime, etc.).
	Info *host.InfoStat `yaml:"info,omitempty" json:"info,omitempty" toml:"info,omitempty"`
}

Host contains host/system details collected for the debug endpoint.

func NewHost

func NewHost(ctx context.Context) *Host

NewHost for debug.

type Load

type Load struct {
	// Avg contains load averages (for example 1m/5m/15m).
	Avg *load.AvgStat `yaml:"avg,omitempty" json:"avg,omitempty" toml:"avg,omitempty"`
}

Load contains system load details collected for the debug endpoint.

func NewLoad

func NewLoad(ctx context.Context) *Load

NewLoad for debug.

type Mem

type Mem struct {
	// Swap contains overall swap memory statistics.
	Swap *mem.SwapMemoryStat `yaml:"swap,omitempty" json:"swap,omitempty" toml:"swap,omitempty"`

	// Virtual contains virtual memory statistics.
	Virtual *mem.VirtualMemoryStat `yaml:"virtual,omitempty" json:"virtual,omitempty" toml:"virtual,omitempty"`

	// Devices contains per-device swap usage information.
	Devices []*mem.SwapDevice `yaml:"devices,omitempty" json:"devices,omitempty" toml:"devices,omitempty"`
}

Mem contains memory details collected for the debug endpoint.

func NewMem

func NewMem(ctx context.Context) *Mem

NewMem for debug.

type Net

type Net struct {
	// Counters contains per-interface network I/O counters.
	Counters []net.IOCountersStat `yaml:"counters,omitempty" json:"counters,omitempty" toml:"counters,omitempty"`
}

Net contains network details collected for the debug endpoint.

func NewNet

func NewNet(ctx context.Context) *Net

NewNet for debug.

type Response

type Response struct {
	// CPU contains CPU information and times.
	CPU *CPU `yaml:"cpu,omitempty" json:"cpu,omitempty" toml:"cpu,omitempty"`

	// Host contains host/system information.
	Host *Host `yaml:"host,omitempty" json:"host,omitempty" toml:"host,omitempty"`

	// Load contains system load averages.
	Load *Load `yaml:"load,omitempty" json:"load,omitempty" toml:"load,omitempty"`

	// Mem contains memory and swap statistics.
	Mem *Mem `yaml:"mem,omitempty" json:"mem,omitempty" toml:"mem,omitempty"`

	// Net contains network I/O counters.
	Net *Net `yaml:"net,omitempty" json:"net,omitempty" toml:"net,omitempty"`
}

Response is the response body returned by the debug psutil endpoint.

Jump to

Keyboard shortcuts

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