sysinfo

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBTypeWeb     string = "web"
	DBTypeOLTP    string = "oltp"
	DBTypeDW      string = "dw"
	DBTypeDesktop string = "desktop"
	DBTypeMixed   string = "mixed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DBType

type DBType string

DBType represents the database workload type

type DiskType

type DiskType string

DiskType represents the type of storage device

const (
	DiskSSD DiskType = "ssd"
	DiskHDD DiskType = "hdd"
	DiskSAN DiskType = "san"
)

type OSType

type OSType string

OSType represents the operating system type

const (
	OSLinux   OSType = "linux"
	OSWindows OSType = "windows"
	OSMac     OSType = "mac"
)

type Resources added in v1.0.4

type Resources struct {
	CPUs   int    `json:"cpus,omitempty"`
	Memory uint64 `json:"memory,omitempty" pretty:"format=bytes"`
	Millis int    `json:"millis,omitempty"` // CPU quota in millicores (e.g., 1500 = 1.5 CPUs)
}

Resources represents physical system resources

func (Resources) Mem added in v1.0.4

func (r Resources) Mem() types.Size

func (Resources) Pretty added in v1.0.4

func (r Resources) Pretty() api.Text

func (Resources) String added in v1.0.4

func (r Resources) String() string

type SystemInfo

type SystemInfo struct {
	// Nested resource information
	System    Resources `json:"system,omitempty"`    // Physical system resources
	Container Resources `json:"container,omitempty"` // nil if not in container

	// Other system information
	IPAddresses       []string `json:"ip_addresses,omitempty"`
	OSType            OSType   `json:"os_type,omitempty"`
	PostgreSQLVersion float64  `json:"postgres_version,omitempty"`
	DiskType          DiskType `json:"disk_type,omitempty"`
	IsContainer       bool     `json:"is_container,omitempty"`
}

SystemInfo contains detected system information

func DetectSystemInfo

func DetectSystemInfo() (*SystemInfo, error)

DetectSystemInfo automatically detects system information

func (*SystemInfo) EffectiveCPUCount added in v1.0.4

func (si *SystemInfo) EffectiveCPUCount() int

EffectiveCPUCount returns the effective CPU count for tuning Uses container CPU limit if available, otherwise system CPUs

func (*SystemInfo) EffectiveMemory added in v1.0.4

func (si *SystemInfo) EffectiveMemory() uint64

EffectiveMemory returns the effective memory for tuning Uses container memory limit if available, otherwise system memory

func (*SystemInfo) TotalMemoryGB

func (si *SystemInfo) TotalMemoryGB() float64

TotalMemoryGB returns effective memory in GB

func (*SystemInfo) TotalMemoryKB

func (si *SystemInfo) TotalMemoryKB() uint64

TotalMemoryKB returns effective memory in KB

func (*SystemInfo) TotalMemoryMB

func (si *SystemInfo) TotalMemoryMB() float64

TotalMemoryMB returns effective memory in MB

Jump to

Keyboard shortcuts

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